From 0e8196cca45664ae092dcfab0e8047ad1dc37084 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 31 Jan 2016 23:29:16 +0000 Subject: build system: have tar use $SOURCE_DATE_EPOCH for --mtime The --mtime argument to 'tar' sets the modification time for all files within the archive, which determines the timestamp files will get when they are extracted. In this case, rootfs and other tarballs will get mtimes which correspond to the last commit timestamp of the build system, as reported by git/subversion. This is a step towards reproducible image builds. Signed-off-by: bryan newbold Signed-off-by: Alexander Couzens Signed-off-by: Felix Fietkau git-svn-id: svn://svn.openwrt.org/openwrt/trunk@48586 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- scripts/sysupgrade-nand.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/sysupgrade-nand.sh b/scripts/sysupgrade-nand.sh index 92b326cbe9..45b17daccd 100755 --- a/scripts/sysupgrade-nand.sh +++ b/scripts/sysupgrade-nand.sh @@ -56,7 +56,12 @@ echo "BOARD=${board}" > "${tmpdir}/sysupgrade-${board}/CONTROL" [ -z "${rootfs}" ] || cp "${rootfs}" "${tmpdir}/sysupgrade-${board}/root" [ -z "${kernel}" ] || cp "${kernel}" "${tmpdir}/sysupgrade-${board}/kernel" -(cd "$tmpdir"; tar cvf sysupgrade.tar sysupgrade-${board}) +mtime="" +if [ -n "$SOURCE_DATE_EPOCH" ]; then + mtime="--mtime=@${SOURCE_DATE_EPOCH}" +fi + +(cd "$tmpdir"; tar cvf sysupgrade.tar sysupgrade-${board} ${mtime}) err="$?" if [ -e "$tmpdir/sysupgrade.tar" ]; then cp "$tmpdir/sysupgrade.tar" "$outfile" -- cgit v1.2.3