summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinitramfs-tools/hooks/samizdat2
-rw-r--r--initrd-dependencies.txt2
-rw-r--r--old-school/lvm-create.sh7
-rw-r--r--old-school/mdadm-dup.sh8
-rwxr-xr-xsamizdat-eject.sh7
5 files changed, 14 insertions, 12 deletions
diff --git a/initramfs-tools/hooks/samizdat b/initramfs-tools/hooks/samizdat
index ac71947..d9d5b5d 100755
--- a/initramfs-tools/hooks/samizdat
+++ b/initramfs-tools/hooks/samizdat
@@ -6,7 +6,7 @@ CopyExec() { copy_exec "$@" || exit 1; }
6 6
7. /usr/share/initramfs-tools/hook-functions 7. /usr/share/initramfs-tools/hook-functions
8 8
9repo_execs=$(echo ./old-school/* loop-layer.sh) 9repo_execs=$(echo ./old-school/* loop-layer.sh samizdat-eject.sh)
10 10
11path_execs='mountpoint openvt rsync gpg2 gpg-agent pinentry-curses truncate cryptsetup mkfs.btrfs btrfs fsck.hfsplus' 11path_execs='mountpoint openvt rsync gpg2 gpg-agent pinentry-curses truncate cryptsetup mkfs.btrfs btrfs fsck.hfsplus'
12 12
diff --git a/initrd-dependencies.txt b/initrd-dependencies.txt
index ffdfae5..cf73861 100644
--- a/initrd-dependencies.txt
+++ b/initrd-dependencies.txt
@@ -10,3 +10,5 @@ isolinux
10nbd-client 10nbd-client
11cryptsetup 11cryptsetup
12hfsprogs 12hfsprogs
13grub-pc
14initramfs-tools
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
diff --git a/samizdat-eject.sh b/samizdat-eject.sh
index 0f4e117..bfd8e1c 100755
--- a/samizdat-eject.sh
+++ b/samizdat-eject.sh
@@ -44,13 +44,8 @@ done
44copy() 44copy()
45{ 45{
46 mdadm_copy_eject_crypt /dev/md55 "$temp_target" && 46 mdadm_copy_eject_crypt /dev/md55 "$temp_target" &&
47 dd if=/dev/md55 of="$target".part && 47 mdadm_copy_eject /dev/md55 "$target".part &&
48 mv "$target".part "$target" 48 mv "$target".part "$target"
49
50 # I suppose at this point $target should be made the backing device of
51 # /dev/md55
52
53 # Alternatively: mdadm --stop /dev/md55
54} 49}
55 50
56remove() 51remove()