Loading nixos/lib/make-ext4-fs.nix +9 −1 Original line number Diff line number Diff line Loading @@ -58,10 +58,18 @@ pkgs.stdenv.mkDerivation { # Make a crude approximation of the size of the target image. # If the script starts failing, increase the fudge factors here. numInodes=$(find ./rootImage | wc -l) numDataBlocks=$(du -s -c -B 4096 --apparent-size ./rootImage | tail -1 | awk '{ print int($1 * 1.10) }') numDataBlocks=$(du -s -c -B 4096 --apparent-size ./rootImage | tail -1 | awk '{ print int($1 * 1.20) }') bytes=$((2 * 4096 * $numInodes + 4096 * $numDataBlocks)) echo "Creating an EXT4 image of $bytes bytes (numInodes=$numInodes, numDataBlocks=$numDataBlocks)" mebibyte=$(( 1024 * 1024 )) # Round up to the nearest mebibyte. # This ensures whole 512 bytes sector sizes in the disk image # and helps towards aligning partitions optimally. if (( bytes % mebibyte )); then bytes=$(( ( bytes / mebibyte + 1) * mebibyte )) fi truncate -s $bytes $img faketime -f "1970-01-01 00:00:01" fakeroot mkfs.ext4 -L ${volumeLabel} -U ${uuid} -d ./rootImage $img Loading Loading
nixos/lib/make-ext4-fs.nix +9 −1 Original line number Diff line number Diff line Loading @@ -58,10 +58,18 @@ pkgs.stdenv.mkDerivation { # Make a crude approximation of the size of the target image. # If the script starts failing, increase the fudge factors here. numInodes=$(find ./rootImage | wc -l) numDataBlocks=$(du -s -c -B 4096 --apparent-size ./rootImage | tail -1 | awk '{ print int($1 * 1.10) }') numDataBlocks=$(du -s -c -B 4096 --apparent-size ./rootImage | tail -1 | awk '{ print int($1 * 1.20) }') bytes=$((2 * 4096 * $numInodes + 4096 * $numDataBlocks)) echo "Creating an EXT4 image of $bytes bytes (numInodes=$numInodes, numDataBlocks=$numDataBlocks)" mebibyte=$(( 1024 * 1024 )) # Round up to the nearest mebibyte. # This ensures whole 512 bytes sector sizes in the disk image # and helps towards aligning partitions optimally. if (( bytes % mebibyte )); then bytes=$(( ( bytes / mebibyte + 1) * mebibyte )) fi truncate -s $bytes $img faketime -f "1970-01-01 00:00:01" fakeroot mkfs.ext4 -L ${volumeLabel} -U ${uuid} -d ./rootImage $img Loading