diff options
Diffstat (limited to 'scripts/lib/wic/plugins/source/rootfs.py')
-rw-r--r-- | scripts/lib/wic/plugins/source/rootfs.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py index 96d940a91d..c990143c0d 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py +++ b/scripts/lib/wic/plugins/source/rootfs.py | |||
@@ -35,7 +35,7 @@ class RootfsPlugin(SourcePlugin): | |||
35 | @staticmethod | 35 | @staticmethod |
36 | def __validate_path(cmd, rootfs_dir, path): | 36 | def __validate_path(cmd, rootfs_dir, path): |
37 | if os.path.isabs(path): | 37 | if os.path.isabs(path): |
38 | logger.error("%s: Must be relative: %s" % (cmd, orig_path)) | 38 | logger.error("%s: Must be relative: %s" % (cmd, path)) |
39 | sys.exit(1) | 39 | sys.exit(1) |
40 | 40 | ||
41 | # Disallow climbing outside of parent directory using '..', | 41 | # Disallow climbing outside of parent directory using '..', |
@@ -43,14 +43,14 @@ class RootfsPlugin(SourcePlugin): | |||
43 | # directory, or modify a directory outside OpenEmbedded). | 43 | # directory, or modify a directory outside OpenEmbedded). |
44 | full_path = os.path.realpath(os.path.join(rootfs_dir, path)) | 44 | full_path = os.path.realpath(os.path.join(rootfs_dir, path)) |
45 | if not full_path.startswith(os.path.realpath(rootfs_dir)): | 45 | if not full_path.startswith(os.path.realpath(rootfs_dir)): |
46 | logger.error("%s: Must point inside the rootfs:" % (cmd, path)) | 46 | logger.error("%s: Must point inside the rootfs: %s" % (cmd, path)) |
47 | sys.exit(1) | 47 | sys.exit(1) |
48 | 48 | ||
49 | return full_path | 49 | return full_path |
50 | 50 | ||
51 | @staticmethod | 51 | @staticmethod |
52 | def __get_rootfs_dir(rootfs_dir): | 52 | def __get_rootfs_dir(rootfs_dir): |
53 | if os.path.isdir(rootfs_dir): | 53 | if rootfs_dir and os.path.isdir(rootfs_dir): |
54 | return os.path.realpath(rootfs_dir) | 54 | return os.path.realpath(rootfs_dir) |
55 | 55 | ||
56 | image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir) | 56 | image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir) |
@@ -97,6 +97,9 @@ class RootfsPlugin(SourcePlugin): | |||
97 | part.has_fstab = os.path.exists(os.path.join(part.rootfs_dir, "etc/fstab")) | 97 | part.has_fstab = os.path.exists(os.path.join(part.rootfs_dir, "etc/fstab")) |
98 | pseudo_dir = os.path.join(part.rootfs_dir, "../pseudo") | 98 | pseudo_dir = os.path.join(part.rootfs_dir, "../pseudo") |
99 | if not os.path.lexists(pseudo_dir): | 99 | if not os.path.lexists(pseudo_dir): |
100 | pseudo_dir = os.path.join(cls.__get_rootfs_dir(None), '../pseudo') | ||
101 | |||
102 | if not os.path.lexists(pseudo_dir): | ||
100 | logger.warn("%s folder does not exist. " | 103 | logger.warn("%s folder does not exist. " |
101 | "Usernames and permissions will be invalid " % pseudo_dir) | 104 | "Usernames and permissions will be invalid " % pseudo_dir) |
102 | pseudo_dir = None | 105 | pseudo_dir = None |
@@ -218,10 +221,10 @@ class RootfsPlugin(SourcePlugin): | |||
218 | # Update part.has_fstab here as fstab may have been added or | 221 | # Update part.has_fstab here as fstab may have been added or |
219 | # removed by the above modifications. | 222 | # removed by the above modifications. |
220 | part.has_fstab = os.path.exists(os.path.join(new_rootfs, "etc/fstab")) | 223 | part.has_fstab = os.path.exists(os.path.join(new_rootfs, "etc/fstab")) |
221 | if part.update_fstab_in_rootfs and part.has_fstab: | 224 | if part.update_fstab_in_rootfs and part.has_fstab and not part.no_fstab_update: |
222 | fstab_path = os.path.join(new_rootfs, "etc/fstab") | 225 | fstab_path = os.path.join(new_rootfs, "etc/fstab") |
223 | # Assume that fstab should always be owned by root with fixed permissions | 226 | # Assume that fstab should always be owned by root with fixed permissions |
224 | install_cmd = "install -m 0644 %s %s" % (part.updated_fstab_path, fstab_path) | 227 | install_cmd = "install -m 0644 -p %s %s" % (part.updated_fstab_path, fstab_path) |
225 | if new_pseudo: | 228 | if new_pseudo: |
226 | pseudo = cls.__get_pseudo(native_sysroot, new_rootfs, new_pseudo) | 229 | pseudo = cls.__get_pseudo(native_sysroot, new_rootfs, new_pseudo) |
227 | else: | 230 | else: |