summary refs log tree commit diff
diff options
context:
space:
mode:
authorhyperfekt <git@hyperfekt.net>2021-08-24 22:46:45 +0000
committerhyperfekt <git@hyperfekt.net>2021-08-25 01:35:31 +0000
commitd5b9aefa439a9da2dae7f533202173745ad7b9e0 (patch)
treeac4224c7dafac141779b90cd1d89a21b9d7b3514
parenta674bfbff4f4049f1972c35d10b5e86d4fcb3104 (diff)
downloadnixpkgs-d5b9aefa439a9da2dae7f533202173745ad7b9e0.tar
nixpkgs-d5b9aefa439a9da2dae7f533202173745ad7b9e0.tar.gz
nixpkgs-d5b9aefa439a9da2dae7f533202173745ad7b9e0.tar.bz2
nixpkgs-d5b9aefa439a9da2dae7f533202173745ad7b9e0.tar.lz
nixpkgs-d5b9aefa439a9da2dae7f533202173745ad7b9e0.tar.xz
nixpkgs-d5b9aefa439a9da2dae7f533202173745ad7b9e0.tar.zst
nixpkgs-d5b9aefa439a9da2dae7f533202173745ad7b9e0.zip
stage-1: fix copytoram option for loopback.cfg boot
Uses an alternative method to find the size of the ISO when it is a file and
not a block device for creating the tmpfs its contents are copied to.
-rw-r--r--nixos/modules/system/boot/stage-1-init.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh
index ddaf985878e..3dfcc010b64 100644
--- a/nixos/modules/system/boot/stage-1-init.sh
+++ b/nixos/modules/system/boot/stage-1-init.sh
@@ -542,7 +542,7 @@ while read -u 3 mountPoint; do
     # If copytoram is enabled: skip mounting the ISO and copy its content to a tmpfs.
     if [ -n "$copytoram" ] && [ "$device" = /dev/root ] && [ "$mountPoint" = /iso ]; then
       fsType=$(blkid -o value -s TYPE "$device")
-      fsSize=$(blockdev --getsize64 "$device")
+      fsSize=$(blockdev --getsize64 "$device" || stat -Lc '%s' "$device")
 
       mkdir -p /tmp-iso
       mount -t "$fsType" /dev/root /tmp-iso