gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / patches / ipxe-reproducible-geniso.patch
CommitLineData
aeed7218
VL
1From 052d24d8217c51c572c2f6cbb4a687be2e8ba52d Mon Sep 17 00:00:00 2001
2From: Brice Waegeneire <brice@waegenei.re>
3Date: Fri, 5 Jun 2020 14:38:43 +0200
4Subject: [PATCH] [geniso] Make it reproducible
5
6Some timestamps get embedded in the generated ISO, making it
7unreproducible so we overwrite those timestamps to be at the UNIX epoch.
8---
9 src/util/geniso | 24 +++++++++++++++++++++---
10 1 file changed, 21 insertions(+), 3 deletions(-)
11
12diff --git a/src/util/geniso b/src/util/geniso
13index ff090d4a..e032ffb0 100755
14--- a/src/util/geniso
15+++ b/src/util/geniso
16@@ -11,6 +11,13 @@ function help() {
17 echo " -o FILE save iso image to file"
18 }
19
20+function reset_timestamp() {
21+ for f in "$1"/*; do
22+ touch -t 197001010100 "$f"
23+ done
24+ touch -t 197001010100 "$1"
25+}
26+
27 LEGACY=0
28 FIRST=""
29
30@@ -37,8 +44,9 @@ if [ -z "${OUT}" ]; then
31 exit 1
32 fi
33
34-# There should either be mkisofs or the compatible genisoimage program
35-for command in genisoimage mkisofs; do
36+# There should either be mkisofs, xorriso or the compatible genisoimage
37+# program
38+for command in xorriso genisoimage mkisofs; do
39 if ${command} --version >/dev/null 2>/dev/null; then
40 mkisofs=(${command})
41 break
42@@ -46,8 +54,10 @@ for command in genisoimage mkisofs; do
43 done
44
45 if [ -z "${mkisofs}" ]; then
46- echo "${0}: mkisofs or genisoimage not found, please install or set PATH" >&2
47+ echo "${0}: mkisofs, xorriso or genisoimage not found, please install or set PATH" >&2
48 exit 1
49+elif [ "$mkisofs" = "xorriso" ]; then
50+ mkisofs+=(-as mkisofs)
51 fi
52
53 dir=$(mktemp -d bin/iso.dir.XXXXXX)
54@@ -115,6 +125,8 @@ case "${LEGACY}" in
55 exit 1
56 fi
57
58+ reset_timestamp "$dir"
59+
60 # generate the iso image
61 "${mkisofs[@]}" -b boot.img -output ${OUT} ${dir}
62 ;;
63@@ -127,6 +139,12 @@ case "${LEGACY}" in
64 cp ${LDLINUX_C32} ${dir}
65 fi
66
67+ reset_timestamp "$dir"
68+
69+ if [ "${mkisofs[0]}" = "xorriso" ]; then
70+ mkisofs+=(-isohybrid-mbr "$SYSLINUX_MBR_DISK_PATH")
71+ fi
72+
73 # generate the iso image
74 "${mkisofs[@]}" -b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -output ${OUT} ${dir}
75
76--
772.26.2