]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
wic/plugins/rootfs: Fix permissions when splitting rootfs folders across partitions
authorFelix Moessbauer <felix.moessbauer@siemens.com>
Fri, 6 May 2022 08:59:41 +0000 (10:59 +0200)
committerAnuj Mittal <anuj.mittal@intel.com>
Fri, 13 May 2022 14:38:11 +0000 (22:38 +0800)
This patches makes locating the file database containing the file and
folder usernames and permissions more reliable.
In addition to locating it relative to the partition directory, we also
try to locate it relative to the IMAGE_ROOTFS.

Prior to this patch, the database was not found when using
--rootfs-dir=${IMAGE_ROOTFS}/<x> in the WIC script, leading to erronous file
permissions and ownership.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 09e18ee246da8b56f446c4db548fb9c7e895142b)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
scripts/lib/wic/plugins/source/rootfs.py

index 2e34e715ca7328cfa0e31c1ab836f5be6ca50c6f..25bb41dd7022ddc64fd970a0f6cd9abe94ef9b66 100644 (file)
@@ -50,7 +50,7 @@ class RootfsPlugin(SourcePlugin):
 
     @staticmethod
     def __get_rootfs_dir(rootfs_dir):
-        if os.path.isdir(rootfs_dir):
+        if rootfs_dir and os.path.isdir(rootfs_dir):
             return os.path.realpath(rootfs_dir)
 
         image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir)
@@ -96,6 +96,9 @@ class RootfsPlugin(SourcePlugin):
         part.rootfs_dir = cls.__get_rootfs_dir(rootfs_dir)
         part.has_fstab = os.path.exists(os.path.join(part.rootfs_dir, "etc/fstab"))
         pseudo_dir = os.path.join(part.rootfs_dir, "../pseudo")
+        if not os.path.lexists(pseudo_dir):
+            pseudo_dir = os.path.join(cls.__get_rootfs_dir(None), '../pseudo')
+
         if not os.path.lexists(pseudo_dir):
             logger.warn("%s folder does not exist. "
                         "Usernames and permissions will be invalid " % pseudo_dir)