diff options
author | Andrew Cady <d@jerkface.net> | 2016-04-28 00:21:24 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2016-04-28 00:21:24 -0400 |
commit | 3d24cae4b9897c17ddcfc4c4d8f150931d2d1f98 (patch) | |
tree | 4fab631dd40e06670469ac4ec7679fcc8079205c /old-school | |
parent | 7cc1d2e6379fde13193f98114c1bfe4a8ec5f6d8 (diff) |
more samizdat-eject fixes
also, copy samizdat-eject from the initramfs to the new rootfs (into
/sbin)
Diffstat (limited to 'old-school')
-rw-r--r-- | old-school/lvm-create.sh | 7 | ||||
-rw-r--r-- | old-school/mdadm-dup.sh | 8 |
2 files changed, 10 insertions, 5 deletions
diff --git a/old-school/lvm-create.sh b/old-school/lvm-create.sh index 916b888..d1ffc51 100644 --- a/old-school/lvm-create.sh +++ b/old-school/lvm-create.sh | |||
@@ -88,6 +88,8 @@ initialize_root_filesystem() | |||
88 | btrfs subvolume create /root/root || return | 88 | btrfs subvolume create /root/root || return |
89 | mv /gpg/gnupghome /root/root/.gnupg || return | 89 | mv /gpg/gnupghome /root/root/.gnupg || return |
90 | 90 | ||
91 | rmdir /root/srv | ||
92 | btrfs subvolume create /root/srv | ||
91 | rm -r /root/var/cache/apt/archives | 93 | rm -r /root/var/cache/apt/archives |
92 | btrfs subvolume create /root/var/cache/apt/archives || return | 94 | btrfs subvolume create /root/var/cache/apt/archives || return |
93 | 95 | ||
@@ -95,7 +97,10 @@ initialize_root_filesystem() | |||
95 | btrfs subvolume create /root/home || return | 97 | btrfs subvolume create /root/home || return |
96 | 98 | ||
97 | [ -x /root/sbin/mdadm ] || cp /sbin/mdadm /root/sbin/ | 99 | [ -x /root/sbin/mdadm ] || cp /sbin/mdadm /root/sbin/ |
98 | [ -e /root/sbin/mdadm-dup.sh ] || cp /bin/mdadm-dup.sh /root/sbin/ | 100 | # Copy these over unconditionally, because they ought to remain in sync with |
101 | # the initrd. | ||
102 | cp /bin/mdadm-dup.sh /root/sbin/ | ||
103 | cp /bin/samizdat-eject.sh /root/sbin/ | ||
99 | 104 | ||
100 | sed -i -e 's/^root:x:/root::/' /root/etc/passwd | 105 | sed -i -e 's/^root:x:/root::/' /root/etc/passwd |
101 | cp /patchroot/* /root/root/ | 106 | cp /patchroot/* /root/root/ |
diff --git a/old-school/mdadm-dup.sh b/old-school/mdadm-dup.sh index fe18e92..c13a325 100644 --- a/old-school/mdadm-dup.sh +++ b/old-school/mdadm-dup.sh | |||
@@ -38,7 +38,7 @@ dm_snapshot() | |||
38 | persist=p | 38 | persist=p |
39 | chunksize=16 | 39 | chunksize=16 |
40 | dmsetup create "$new_dev_name" --table "0 $size snapshot $ro_dev $rw_dev $persist $chunksize" || return | 40 | dmsetup create "$new_dev_name" --table "0 $size snapshot $ro_dev $rw_dev $persist $chunksize" || return |
41 | wait_for_dm_device /dev/mapper/"$new_dev_name"; | 41 | wait_for_dm_device /dev/mapper/"$new_dev_name" |
42 | echo /dev/mapper/"$new_dev_name" | 42 | echo /dev/mapper/"$new_dev_name" |
43 | } | 43 | } |
44 | 44 | ||
@@ -54,7 +54,7 @@ dm_snapshot_teardown() | |||
54 | # errors ignored because the loop dev can be configured to be | 54 | # errors ignored because the loop dev can be configured to be |
55 | # automatically removed upon disuse | 55 | # automatically removed upon disuse |
56 | losetup -d /dev/block/"$rw_dev" || true | 56 | losetup -d /dev/block/"$rw_dev" || true |
57 | eject /dev/block/"$ro_dev" || exit 1 | 57 | eject /dev/block/"$ro_dev" || true |
58 | ) || return | 58 | ) || return |
59 | ;; | 59 | ;; |
60 | *) return 1 ;; | 60 | *) return 1 ;; |
@@ -106,7 +106,7 @@ mdadm_dup() | |||
106 | { | 106 | { |
107 | local input_dev="$1" md_name="$2" sectors="$3" | 107 | local input_dev="$1" md_name="$2" sectors="$3" |
108 | 108 | ||
109 | mdadm --build $md_name ${sectors:+--size=$((sectors / 2))} \ | 109 | mdadm --build "$md_name" "${sectors:+--size=$((sectors / 2))}" \ |
110 | --level=1 --raid-devices=1 --force --write-mostly "$input_dev" || return | 110 | --level=1 --raid-devices=1 --force --write-mostly "$input_dev" || return |
111 | } | 111 | } |
112 | 112 | ||
@@ -132,6 +132,7 @@ cryptsetup_temp() | |||
132 | set $parms | 132 | set $parms |
133 | 133 | ||
134 | wait_for_dm_device /dev/mapper/"$cryptname" | 134 | wait_for_dm_device /dev/mapper/"$cryptname" |
135 | rm "$temp_file" | ||
135 | echo /dev/mapper/"$cryptname" | 136 | echo /dev/mapper/"$cryptname" |
136 | } | 137 | } |
137 | 138 | ||
@@ -140,7 +141,6 @@ mdadm_copy_eject_crypt() | |||
140 | local md_dev="$1" temp_file="$2" | 141 | local md_dev="$1" temp_file="$2" |
141 | 142 | ||
142 | [ -b "$md_dev" ] || return | 143 | [ -b "$md_dev" ] || return |
143 | [ ! -e "$temp_file" ] || return | ||
144 | 144 | ||
145 | local output_dev sectors | 145 | local output_dev sectors |
146 | 146 | ||