aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules/system/boot/stage-1-init.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/system/boot/stage-1-init.sh')
-rw-r--r--nixpkgs/nixos/modules/system/boot/stage-1-init.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/system/boot/stage-1-init.sh b/nixpkgs/nixos/modules/system/boot/stage-1-init.sh
index b817a45deba..f520bf54ad1 100644
--- a/nixpkgs/nixos/modules/system/boot/stage-1-init.sh
+++ b/nixpkgs/nixos/modules/system/boot/stage-1-init.sh
@@ -183,6 +183,12 @@ for o in $(cat /proc/cmdline); do
copytoram)
copytoram=1
;;
+ findiso=*)
+ # if an iso name is supplied, try to find the device where
+ # the iso resides on
+ set -- $(IFS==; echo $o)
+ isoPath=$2
+ ;;
esac
done
@@ -442,6 +448,27 @@ if test -e /sys/power/resume -a -e /sys/power/disk; then
fi
fi
+# If we have a path to an iso file, find the iso and link it to /dev/root
+if [ -n "$isoPath" ]; then
+ mkdir -p /findiso
+
+ for delay in 5 10; do
+ blkid | while read -r line; do
+ device=$(echo "$line" | sed 's/:.*//')
+ type=$(echo "$line" | sed 's/.*TYPE="\([^"]*\)".*/\1/')
+
+ mount -t "$type" "$device" /findiso
+ if [ -e "/findiso$isoPath" ]; then
+ ln -sf "/findiso$isoPath" /dev/root
+ break 2
+ else
+ umount /findiso
+ fi
+ done
+
+ sleep "$delay"
+ done
+fi
# Try to find and mount the root device.
mkdir -p $targetRoot