From 66b5c3933b0f28d57020b66524bb8b115dee225d Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Tue, 19 Apr 2016 20:42:14 -0400 Subject: implement menu select option for booting with ramdisk root --- initramfs-tools/scripts/samizdat | 33 ++++++++++++++++----------------- old-school/menu-select | 20 +++++++++++--------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/initramfs-tools/scripts/samizdat b/initramfs-tools/scripts/samizdat index e8f5198..2bc16f8 100644 --- a/initramfs-tools/scripts/samizdat +++ b/initramfs-tools/scripts/samizdat @@ -2,26 +2,15 @@ klogd -c1 # TODO: This should be even earlier. Can it go on the kernel command mountroot() { - mkdir /cdrom /btrfs - mount -t iso9660 /dev/sr0 /cdrom - mount -t btrfs -o loop,subvol=ROOT /cdrom/live/filesystem.btrfs /btrfs - modprobe brd rd_size=$((256 * 1024 * 2)) - btrfs device add /dev/ram0 /btrfs - mount -o rw,remount /btrfs - mount -o move /btrfs /root - mkdir /root/cdrom - mount -o move /cdrom /root/cdrom - - sed -i -e 's/^root:x:/root::/' /root/etc/passwd - - samizdat_install_udev_rules - openvt -c 13 sh - mkfifo "$MENUFIFO" || panic "mkfifo '$MENUFIFO' failed" + samizdat_install_udev_rules + mkfifo "$MENUFIFO" bootmenu + bootwait root-mounted + chvt 1 - sleep 1000 + sed -i -e 's/^root:x:/root::/' /root/etc/passwd } samizdat_install_udev_rules() @@ -70,4 +59,14 @@ bootmenu() menutitle 'Samizdat\n\nAs the Internet develops there are\ntransitions in the management arrangements.\nThe time has come to take\na small step in one of those transitions.' 'Choose an installation target.' # menutitle 'Samizdat\nfreedom from surveillance\nno trusted authorities' 'Choose an installation target.' addmenu "ramdisk" "[ Boot to RAM without installing anything ]" "menu-select boot-ram" -} \ No newline at end of file +} + +bootwait() +{ + mkdir -p /bootwait + local i=$#; while [ $i -gt 0 ]; do + i=$((i-1)) + local f="$1"; shift; set -- "$@" "/bootwait/$f" + done + wait_for_files "$@" +} diff --git a/old-school/menu-select b/old-school/menu-select index 0cc0c67..5f0848f 100755 --- a/old-school/menu-select +++ b/old-school/menu-select @@ -62,15 +62,17 @@ hwclock_to_system() case "$1" in boot-ram) - modprobe squashfs || true - find_squashfs_root | mountsquashes || error - mkdir /overlay || error - mount -t tmpfs tmpfs /overlay || error - mkdir /overlay/gpg || error - ln -s /overlay/gpg /gpg - - init_gpg || error - bootdone squashfs-root rw-overlay + mkdir /cdrom /btrfs + bootwait samizdat-cdrom + mount -t btrfs -o loop,subvol=ROOT /cdrom/live/filesystem.btrfs /btrfs + modprobe brd rd_size=$((256 * 1024 * 2)) + btrfs device add /dev/ram0 /btrfs + mount -o rw,remount /btrfs + mount -o move /btrfs /root + mkdir /root/cdrom + mount -o move /cdrom /root/cdrom + + bootdone root-mounted ;; boot-overwrite|boot-new|boot-luks) dev="$2" -- cgit v1.2.3