diff options
author | Sandro <sandro.jaeckel@gmail.com> | 2021-06-26 21:50:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-26 21:50:20 +0200 |
commit | 5faf13ddadc30c81430b5da73fe72dad259f4034 (patch) | |
tree | 31fdb691e826901be4e4b41e67d875deac068786 /nixos/modules/installer/cd-dvd/iso-image.nix | |
parent | 1d60b17566f6d046270f0121f80641bbd678e0a8 (diff) | |
parent | 657e924ad853e099cbc36be50478e9877aa05a25 (diff) | |
download | nixpkgs-5faf13ddadc30c81430b5da73fe72dad259f4034.tar nixpkgs-5faf13ddadc30c81430b5da73fe72dad259f4034.tar.gz nixpkgs-5faf13ddadc30c81430b5da73fe72dad259f4034.tar.bz2 nixpkgs-5faf13ddadc30c81430b5da73fe72dad259f4034.tar.lz nixpkgs-5faf13ddadc30c81430b5da73fe72dad259f4034.tar.xz nixpkgs-5faf13ddadc30c81430b5da73fe72dad259f4034.tar.zst nixpkgs-5faf13ddadc30c81430b5da73fe72dad259f4034.zip |
Merge pull request #119657 from syncom/syncom/deterministic-efiimg
Diffstat (limited to 'nixos/modules/installer/cd-dvd/iso-image.nix')
-rw-r--r-- | nixos/modules/installer/cd-dvd/iso-image.nix | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index 4e5d888c4bb..d94af0b5bf7 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -428,7 +428,8 @@ let # Rewrite dates for everything in the FS find . -exec touch --date=2000-01-01 {} + - usage_size=$(du -sb --apparent-size . | tr -cd '[:digit:]') + # Round up to the nearest multiple of 1MB, for more deterministic du output + usage_size=$(( $(du -s --block-size=1M --apparent-size . | tr -cd '[:digit:]') * 1024 * 1024 )) # Make the image 110% as big as the files need to make up for FAT overhead image_size=$(( ($usage_size * 110) / 100 )) # Make the image fit blocks of 1M @@ -438,7 +439,16 @@ let echo "Image size: $image_size" truncate --size=$image_size "$out" faketime "2000-01-01 00:00:00" mkfs.vfat -i 12345678 -n EFIBOOT "$out" - mcopy -psvm -i "$out" ./EFI ./boot :: + + # Force a fixed order in mcopy for better determinism, and avoid file globbing + for d in $(find EFI boot -type d | sort); do + faketime "2000-01-01 00:00:00" mmd -i "$out" "::/$d" + done + + for f in $(find EFI boot -type f | sort); do + mcopy -pvm -i "$out" "$f" "::/$f" + done + # Verify the FAT partition. fsck.vfat -vn "$out" ''; # */ |