iso-image: Workaround for better determinism in du output
The value of du output depends on the underlying file system, and thus is not fully deterministic. This workaround rounds up the disk usage size to the nearest multiple of 1MB, to increase the probability that two du output values on two different file systems fall within the same 1MB window. Note that this workaround won't make du output 100% reproducible, but will increase the probability of getting deterministic builds across different file systems.
This commit is contained in:
parent
e3cd644458
commit
4db7eb476f
1 changed files with 2 additions and 1 deletions
|
@ -405,7 +405,8 @@ let
|
|||
"${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}" ./boot/
|
||||
touch --date=@0 ./EFI ./boot
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue