Use SOURCE_DATE_EPOCH for rescue ISO timestamps
The grub-rescue-cdrom.iso
file built for the Debian grub-rescue-pc
package differs between builds due to timestamps on the files created inside the ISO image.
The image itself is constructed by the grub-mkrescue
utility, that in turn uses xorisso
, in 'mkisofs emulation' mode.
To achieve deterministic (reproducible) build output, this changeset applies two changes to the grub-mkrescue
code:
- Read the timestamp to use when writing time-related information to the rescue ISO from
SOURCE_DATE_EPOCH
, when that variable is set (using a code snippet from the Reproducible Builds project's documentation). - Use the
--set_all_file_dates
command-line option available when usingxorriso -as mkisofs
to apply the timestamp to all files within the image.
I've confirmed that this allows me to build the rescue ISO image deterministically on my local machine; I haven't tested the resulting image for any practical rescue purposes.
Closes: #787795