summaryrefslogtreecommitdiff
path: root/old-school/lvm-create.sh
diff options
context:
space:
mode:
Diffstat (limited to 'old-school/lvm-create.sh')
-rw-r--r--old-school/lvm-create.sh26
1 files changed, 25 insertions, 1 deletions
diff --git a/old-school/lvm-create.sh b/old-school/lvm-create.sh
index ce0862e..916b888 100644
--- a/old-school/lvm-create.sh
+++ b/old-school/lvm-create.sh
@@ -53,12 +53,35 @@ init_samizdat()
53 53
54 btrfs device add "$blockdev" /root || return 54 btrfs device add "$blockdev" /root || return
55 mount -o rw,remount /root || return 55 mount -o rw,remount /root || return
56 samizdat_movemounts "$imgfile"
56 57
57 initialize_root_filesystem || return 58 initialize_root_filesystem || return
58 59
59 bootdone root-mounted 60 bootdone root-mounted
60} 61}
61 62
63samizdat_movemounts()
64{
65 local imgfile="$1" mountpoint
66
67 mountpoint=$(mountpoint_of "$imgfile") || return
68 mkdir /root/cdrom /root/outerfs
69 mount -o move /cdrom /root/cdrom
70 mount -o move "$mountpoint" /root/outerfs
71 mkdir /run/initramfs/samizdat
72 mv /var/log /run/initramfs/samizdat/log
73}
74
75mountpoint_of()
76{
77 local f="$1"
78 while ! mountpoint -q "$f"; do
79 f=$(dirname "$f")
80 [ "$f" != '.' ] || return 1
81 done
82 printf '%s\n' "$f"
83}
84
62initialize_root_filesystem() 85initialize_root_filesystem()
63{ 86{
64 rm -r /root/root 87 rm -r /root/root
@@ -117,7 +140,7 @@ filesystem_incomplete()
117open_samizdat() 140open_samizdat()
118{ 141{
119 open_samizdat_blockdev "$@" || return 142 open_samizdat_blockdev "$@" || return
120 local blockdev=/dev/mapper/samizdatcrypt fs 143 local blockdev=/dev/mapper/samizdatcrypt imgfile="$1" fs
121 144
122 # For this part, we don't necessarily need the cdrom. 145 # For this part, we don't necessarily need the cdrom.
123 # Unfortunately the init_gpg code is still getting the GPG key there. 146 # Unfortunately the init_gpg code is still getting the GPG key there.
@@ -127,6 +150,7 @@ open_samizdat()
127 modprobe btrfs || return 150 modprobe btrfs || return
128 btrfs device scan || return 151 btrfs device scan || return
129 mount -t btrfs -o subvol=ROOT "$blockdev" /root || return 152 mount -t btrfs -o subvol=ROOT "$blockdev" /root || return
153 samizdat_movemounts "$imgfile"
130 LoSetup -D 154 LoSetup -D
131 bootdone root-mounted 155 bootdone root-mounted
132} 156}