summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugins/source/rootfs.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/plugins/source/rootfs.py')
-rw-r--r--scripts/lib/wic/plugins/source/rootfs.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index f19ec3312b..c8c1c0f58f 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -77,6 +77,7 @@ class RootfsPlugin(SourcePlugin):
77 "it is not a valid path, exiting" % part.rootfs_dir) 77 "it is not a valid path, exiting" % part.rootfs_dir)
78 78
79 part.rootfs_dir = cls.__get_rootfs_dir(rootfs_dir) 79 part.rootfs_dir = cls.__get_rootfs_dir(rootfs_dir)
80 part.has_fstab = os.path.exists(os.path.join(part.rootfs_dir, "etc/fstab"))
80 pseudo_dir = os.path.join(part.rootfs_dir, "../pseudo") 81 pseudo_dir = os.path.join(part.rootfs_dir, "../pseudo")
81 if not os.path.lexists(pseudo_dir): 82 if not os.path.lexists(pseudo_dir):
82 logger.warn("%s folder does not exist. " 83 logger.warn("%s folder does not exist. "
@@ -86,7 +87,7 @@ class RootfsPlugin(SourcePlugin):
86 new_rootfs = None 87 new_rootfs = None
87 new_pseudo = None 88 new_pseudo = None
88 # Handle excluded paths. 89 # Handle excluded paths.
89 if part.exclude_path or part.include_path or part.change_directory or part.updated_fstab_path: 90 if part.exclude_path or part.include_path or part.change_directory or part.update_fstab_in_rootfs:
90 # We need a new rootfs directory we can safely modify without 91 # We need a new rootfs directory we can safely modify without
91 # interfering with other tasks. Copy to workdir. 92 # interfering with other tasks. Copy to workdir.
92 new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d" % part.lineno)) 93 new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d" % part.lineno))
@@ -159,8 +160,10 @@ class RootfsPlugin(SourcePlugin):
159 rm_cmd = "rm -rf %s" % (full_path) 160 rm_cmd = "rm -rf %s" % (full_path)
160 exec_native_cmd(rm_cmd, native_sysroot, pseudo) 161 exec_native_cmd(rm_cmd, native_sysroot, pseudo)
161 162
162 has_fstab = os.path.exists(os.path.join(new_rootfs, "etc/fstab")) 163 # Update part.has_fstab here as fstab may have been added or
163 if part.updated_fstab_path and has_fstab: 164 # removed by the above modifications.
165 part.has_fstab = os.path.exists(os.path.join(new_rootfs, "etc/fstab"))
166 if part.update_fstab_in_rootfs and part.has_fstab:
164 fstab_path = os.path.join(new_rootfs, "etc/fstab") 167 fstab_path = os.path.join(new_rootfs, "etc/fstab")
165 # Assume that fstab should always be owned by root with fixed permissions 168 # Assume that fstab should always be owned by root with fixed permissions
166 install_cmd = "install -m 0644 %s %s" % (part.updated_fstab_path, fstab_path) 169 install_cmd = "install -m 0644 %s %s" % (part.updated_fstab_path, fstab_path)