diff options
author | lassulus <lass@lassul.us> | 2017-04-18 13:45:30 +0200 |
---|---|---|
committer | lassulus <lass@lassul.us> | 2017-04-28 20:48:09 +0200 |
commit | 87a4615e27bf14ab5d3949fce47aa05a81ece47c (patch) | |
tree | b6f5ff82822bf2114a5431ab6d478dce144abcfc /nixos/modules/system/boot | |
parent | 91ad6b35970b1378ac99de209b4ec48318704b07 (diff) | |
download | nixlib-87a4615e27bf14ab5d3949fce47aa05a81ece47c.tar nixlib-87a4615e27bf14ab5d3949fce47aa05a81ece47c.tar.gz nixlib-87a4615e27bf14ab5d3949fce47aa05a81ece47c.tar.bz2 nixlib-87a4615e27bf14ab5d3949fce47aa05a81ece47c.tar.lz nixlib-87a4615e27bf14ab5d3949fce47aa05a81ece47c.tar.xz nixlib-87a4615e27bf14ab5d3949fce47aa05a81ece47c.tar.zst nixlib-87a4615e27bf14ab5d3949fce47aa05a81ece47c.zip |
nixos/stage1: add copytoram support
Diffstat (limited to 'nixos/modules/system/boot')
-rw-r--r-- | nixos/modules/system/boot/stage-1-init.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh index c75e637124a9..9a125dcb0aeb 100644 --- a/nixos/modules/system/boot/stage-1-init.sh +++ b/nixos/modules/system/boot/stage-1-init.sh @@ -154,6 +154,9 @@ for o in $(cat /proc/cmdline); do fi ln -s "$root" /dev/root ;; + copytoram) + copytoram=1 + ;; esac done @@ -474,6 +477,22 @@ while read -u 3 mountPoint; do # doing something with $device right now. udevadm settle + # 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") + + mkdir -p /tmp-iso + mount -t "$fsType" /dev/root /tmp-iso + mountFS tmpfs /iso size="$fsSize" tmpfs + + cp -r /tmp-iso/* /mnt-root/iso/ + + umount /tmp-iso + rmdir /tmp-iso + continue + fi + mountFS "$device" "$mountPoint" "$options" "$fsType" done |