diff options
Diffstat (limited to 'old-school')
-rw-r--r-- | old-school/lvm-create.sh | 41 | ||||
-rwxr-xr-x | old-school/menu-select | 27 |
2 files changed, 31 insertions, 37 deletions
diff --git a/old-school/lvm-create.sh b/old-school/lvm-create.sh index d1ffc51..0e88995 100644 --- a/old-school/lvm-create.sh +++ b/old-school/lvm-create.sh | |||
@@ -28,6 +28,8 @@ ceil4() | |||
28 | 28 | ||
29 | losetup_layers() | 29 | losetup_layers() |
30 | { | 30 | { |
31 | bootwait samizdat-cdrom | ||
32 | local fs fs_rw | ||
31 | for fs in /cdrom/rootfs/*.btrfs; do | 33 | for fs in /cdrom/rootfs/*.btrfs; do |
32 | fs_rw=/"${fs##*/}".rw | 34 | fs_rw=/"${fs##*/}".rw |
33 | dd if=/dev/zero of="$fs_rw" bs=1M count=10 | 35 | dd if=/dev/zero of="$fs_rw" bs=1M count=10 |
@@ -37,25 +39,22 @@ losetup_layers() | |||
37 | 39 | ||
38 | init_samizdat() | 40 | init_samizdat() |
39 | { | 41 | { |
40 | local imgfile="$1" megs="$2" keyfile="$3" dev fs fs_rw | 42 | local blockdev="$1" imgfile="$2" uuid |
41 | 43 | ||
42 | init_samizdat_blockdev "$imgfile" "$megs" "$keyfile" || return | 44 | losetup_layers || return |
43 | local blockdev=/dev/mapper/samizdatcrypt uuid | 45 | modprobe btrfs || return |
46 | btrfs device scan || return | ||
44 | 47 | ||
45 | losetup_layers || return | 48 | uuid=$(choose_uuid) || return |
46 | modprobe btrfs || return | 49 | [ "$uuid" ] || return |
47 | btrfs device scan || return | ||
48 | |||
49 | uuid=$(choose_uuid) || return | ||
50 | [ "$uuid" ] | ||
51 | 50 | ||
52 | mount -t btrfs -o subvol=ROOT UUID="$uuid" /root || return | 51 | mount -t btrfs -o subvol=ROOT UUID="$uuid" /root || return |
53 | 52 | ||
54 | btrfs device add "$blockdev" /root || return | 53 | btrfs device add "$blockdev" /root || return |
55 | mount -o rw,remount /root || return | 54 | mount -o rw,remount /root || return |
56 | samizdat_movemounts "$imgfile" | 55 | samizdat_movemounts "$imgfile" || return |
57 | 56 | ||
58 | initialize_root_filesystem || return | 57 | initialize_root_filesystem || return |
59 | 58 | ||
60 | bootdone root-mounted | 59 | bootdone root-mounted |
61 | } | 60 | } |
@@ -64,12 +63,16 @@ samizdat_movemounts() | |||
64 | { | 63 | { |
65 | local imgfile="$1" mountpoint | 64 | local imgfile="$1" mountpoint |
66 | 65 | ||
67 | mountpoint=$(mountpoint_of "$imgfile") || return | 66 | if [ "$imgfile" ]; then |
68 | mkdir /root/cdrom /root/outerfs | 67 | mountpoint=$(mountpoint_of "$imgfile") || return |
68 | mkdir /root/outerfs | ||
69 | mount -o move "$mountpoint" /root/outerfs | ||
70 | fi | ||
71 | mkdir /root/cdrom | ||
69 | mount -o move /cdrom /root/cdrom | 72 | mount -o move /cdrom /root/cdrom |
70 | mount -o move "$mountpoint" /root/outerfs | 73 | # mkdir /run/initramfs/samizdat |
71 | mkdir /run/initramfs/samizdat | 74 | # mv /var/log /run/initramfs/samizdat/log |
72 | mv /var/log /run/initramfs/samizdat/log | 75 | true |
73 | } | 76 | } |
74 | 77 | ||
75 | mountpoint_of() | 78 | mountpoint_of() |
@@ -162,7 +165,7 @@ open_samizdat() | |||
162 | 165 | ||
163 | init_samizdat_lodev() | 166 | init_samizdat_lodev() |
164 | { | 167 | { |
165 | local imgfile="$1" megs=$(ceil4 "$2") | 168 | local imgfile="$1" megs=$(ceil4 "$2") dev |
166 | truncate -s ${megs}M "$imgfile" || return | 169 | truncate -s ${megs}M "$imgfile" || return |
167 | dev=$(losetup -f) && losetup "$dev" "$imgfile" || return | 170 | dev=$(losetup -f) && losetup "$dev" "$imgfile" || return |
168 | echo "$dev" | 171 | echo "$dev" |
diff --git a/old-school/menu-select b/old-school/menu-select index 1dbd847..9b340ac 100755 --- a/old-school/menu-select +++ b/old-school/menu-select | |||
@@ -62,28 +62,18 @@ hwclock_to_system() | |||
62 | 62 | ||
63 | case "$1" in | 63 | case "$1" in |
64 | boot-ram) | 64 | boot-ram) |
65 | mkdir /cdrom /btrfs | ||
66 | bootwait samizdat-cdrom | ||
67 | |||
68 | losetup_layers || error | ||
69 | modprobe btrfs || error | ||
70 | btrfs device scan || error | ||
71 | uuid=$(choose_uuid) || error | ||
72 | [ "$uuid" ] || error | ||
73 | |||
74 | mount -t btrfs -o loop,subvol=ROOT UUID="$uuid" /btrfs | ||
75 | memtotal=$(sed -ne 's/MemTotal: *//p' /proc/meminfo) | 65 | memtotal=$(sed -ne 's/MemTotal: *//p' /proc/meminfo) |
76 | ramdisk=$((1024 * ${memtotal% *} / 2)) | 66 | ramdisk=$((1024 * ${memtotal% *} / 2)) |
77 | [ $ramdisk -ge 256 ] || ramdisk=256 | 67 | [ $ramdisk -ge 256 ] || ramdisk=256 |
78 | modprobe brd rd_size=$ramdisk | 68 | modprobe brd rd_size=$ramdisk |
79 | 69 | ||
80 | btrfs device add /dev/ram0 /btrfs | 70 | init_gpg || error |
81 | mount -o rw,remount /btrfs | 71 | init_samizdat /dev/ram0 '' || { |
82 | mount -o move /btrfs /root | 72 | umount /root/cdrom |
83 | mkdir /root/cdrom | 73 | umount /root/outerfs |
84 | mount -o move /cdrom /root/cdrom | 74 | umount /root |
85 | 75 | error | |
86 | bootdone root-mounted | 76 | } |
87 | ;; | 77 | ;; |
88 | boot-overwrite|boot-new|boot-luks) | 78 | boot-overwrite|boot-new|boot-luks) |
89 | dev="$2" | 79 | dev="$2" |
@@ -109,7 +99,8 @@ case "$1" in | |||
109 | 99 | ||
110 | start_meter "Allocating ${megs}MB in '$loopfile' on $dev..." | 100 | start_meter "Allocating ${megs}MB in '$loopfile' on $dev..." |
111 | 101 | ||
112 | if init_samizdat "$loopfile" "$megs" "$loopfile"k; then | 102 | if init_samizdat_blockdev "$loopfile" "$megs" "$loopfile"k && |
103 | init_samizdat /dev/mapper/samizdatcrypt "$imgfile"; then | ||
113 | stop_meter done. | 104 | stop_meter done. |
114 | else | 105 | else |
115 | stop_meter error! | 106 | stop_meter error! |