summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/partition.py
diff options
context:
space:
mode:
authorSergei Zhmylev <s.zhmylev@yadro.com>2022-10-21 17:56:22 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-11-10 14:39:24 +0000
commit7a31cf96eb47049f4cefe6e7f1eaaad32db8730c (patch)
tree85c21710922f306d823fd8e5602a3b5f8d559604 /scripts/lib/wic/partition.py
parent03a7c1df50e789b2d632042d29e15b4d76685696 (diff)
downloadpoky-7a31cf96eb47049f4cefe6e7f1eaaad32db8730c.tar.gz
wic: honor the SOURCE_DATE_EPOCH in case of updated fstab
In case user requested to build a binary repeatable package, it's required to honor the SOURCE_DATE_EPOCH environment variable. So forcefully set mtime inside all the routines which modify fstab in case it is updated. (From OE-Core rev: 2671667f33d0eac1425db3fc4dff56d4eed1eb3c) Signed-off-by: Sergei Zhmylev <s.zhmylev@yadro.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> (cherry picked from commit 99719a3712a88dce8450994d995803e126e49115) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/partition.py')
-rw-r--r--scripts/lib/wic/partition.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 09e491dd49..7c288d2958 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -293,6 +293,11 @@ class Partition():
293 f.write("cd etc\n") 293 f.write("cd etc\n")
294 f.write("rm fstab\n") 294 f.write("rm fstab\n")
295 f.write("write %s fstab\n" % (self.updated_fstab_path)) 295 f.write("write %s fstab\n" % (self.updated_fstab_path))
296 if os.getenv('SOURCE_DATE_EPOCH'):
297 fstab_time = int(os.getenv('SOURCE_DATE_EPOCH'))
298 for time in ["atime", "mtime", "ctime"]:
299 f.write("set_inode_field fstab %s %s\n" % (time, hex(fstab_time)))
300 f.write("set_inode_field fstab %s_extra 0\n" % (time))
296 debugfs_cmd = "debugfs -w -f %s %s" % (debugfs_script_path, rootfs) 301 debugfs_cmd = "debugfs -w -f %s %s" % (debugfs_script_path, rootfs)
297 exec_native_cmd(debugfs_cmd, native_sysroot) 302 exec_native_cmd(debugfs_cmd, native_sysroot)
298 303
@@ -352,7 +357,7 @@ class Partition():
352 exec_native_cmd(mcopy_cmd, native_sysroot) 357 exec_native_cmd(mcopy_cmd, native_sysroot)
353 358
354 if self.updated_fstab_path and self.has_fstab and not self.no_fstab_update: 359 if self.updated_fstab_path and self.has_fstab and not self.no_fstab_update:
355 mcopy_cmd = "mcopy -i %s %s ::/etc/fstab" % (rootfs, self.updated_fstab_path) 360 mcopy_cmd = "mcopy -m -i %s %s ::/etc/fstab" % (rootfs, self.updated_fstab_path)
356 exec_native_cmd(mcopy_cmd, native_sysroot) 361 exec_native_cmd(mcopy_cmd, native_sysroot)
357 362
358 chmod_cmd = "chmod 644 %s" % rootfs 363 chmod_cmd = "chmod 644 %s" % rootfs