summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--initrd-dependencies.txt3
-rw-r--r--old-school/lvm-create.sh22
-rwxr-xr-xpatchroot.sh2
-rwxr-xr-xsamizdat-eject.sh47
4 files changed, 69 insertions, 5 deletions
diff --git a/initrd-dependencies.txt b/initrd-dependencies.txt
index 6f4f9e6..9265bcb 100644
--- a/initrd-dependencies.txt
+++ b/initrd-dependencies.txt
@@ -3,3 +3,6 @@ pgpdump
3monkeysphere 3monkeysphere
4libmime-base32-perl 4libmime-base32-perl
5pinentry-curses 5pinentry-curses
6mdadm
7ntfs-3g
8hfsplus
diff --git a/old-school/lvm-create.sh b/old-school/lvm-create.sh
index ecbae49..b6d38d2 100644
--- a/old-school/lvm-create.sh
+++ b/old-school/lvm-create.sh
@@ -1,6 +1,4 @@
1#!/bin/sh 1#!/bin/sh
2: ${ROOT_MKFS_CMD:=mkfs.ext4 -q}
3: ${ROOT_FS_TYPE:=ext4}
4 2
5losetup() { /sbin/losetup "$@"; } 3losetup() { /sbin/losetup "$@"; }
6 4
@@ -55,12 +53,28 @@ init_samizdat()
55 53
56 btrfs device add "$blockdev" /root || return 54 btrfs device add "$blockdev" /root || return
57 mount -o rw,remount /root || return 55 mount -o rw,remount /root || return
58 btrfs subvolume create /root/gpg || return 56
59 mv /gpg/gnupghome /root/gpg/ || return 57 initialize_root_filesystem || return
60 58
61 bootdone root-mounted 59 bootdone root-mounted
62} 60}
63 61
62initialize_root_filesystem()
63{
64 btrfs subvolume create /root/gpg || return
65 mv /gpg/gnupghome /root/gpg/ || return
66
67 rm -r /root/var/cache/apt/archives
68 btrfs subvolume create /root/var/cache/apt/archives || return
69
70 rmdir /root/home
71 btrfs subvolume create /root/home || return
72
73 [ -x /root/sbin/mdadm ] || cp /sbin/mdadm /root/sbin/
74 [ -e /root/sbin/mdadm-dup.sh ] || cp /bin/mdadm-dup.sh /root/sbin/
75 true
76}
77
64# Get the uuid of the filesystem with the most devices, 78# Get the uuid of the filesystem with the most devices,
65# excluding filesystems that don't incorporate loop devices. 79# excluding filesystems that don't incorporate loop devices.
66# This is used to choose the latest seed -- which should have 80# This is used to choose the latest seed -- which should have
diff --git a/patchroot.sh b/patchroot.sh
index e211377..3efa8ec 100755
--- a/patchroot.sh
+++ b/patchroot.sh
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2 2
3pkgs='avahi-daemon git tmux btrfs-tools/jessie-backports sshfs' 3pkgs='avahi-daemon git tmux btrfs-tools/jessie-backports sshfs eject'
4pkgs="$pkgs $(cat initrd-dependencies.txt)" 4pkgs="$pkgs $(cat initrd-dependencies.txt)"
5pkgs="$pkgs linux-image-$(uname -r)" 5pkgs="$pkgs linux-image-$(uname -r)"
6 6
diff --git a/samizdat-eject.sh b/samizdat-eject.sh
new file mode 100755
index 0000000..04ee610
--- /dev/null
+++ b/samizdat-eject.sh
@@ -0,0 +1,47 @@
1#!/bin/sh
2
3. mdadm-dup.sh || exit 1
4
5btrfs_subdevices()
6{
7 local mountpoint="$1"
8 btrfs filesystem show "$mountpoint" | sed -ne 's/^[ \t]*devid.* path //p'
9}
10
11devices=$(btrfs_subdevices /) || exit 1
12
13set --
14seen=
15for dev in $devices; do
16 [ -b "$dev" ] || exit 1
17 case "$dev" in
18 /dev/mapper/loop*) set -- "$@" "$dev" ;;
19 /dev/mapper/samizdatcrypt) seen=y ;;
20 esac
21done
22[ "$seen" ] || exit 1
23
24copy()
25{
26 mdadm_copy_eject /dev/md55 /root/samizdat.iso
27}
28
29remove()
30{
31 for dev; do
32 (set -x; btrfs device remove "$dev" /)
33 done
34}
35
36# Doing the mdadm copy before removing the devices means our filesystem includes
37# devices that are ultimately backed by files ON THE SAME FILESYSTEM. As such, it
38# might conceivably put btrfs into a deadlock of some kind.
39
40# If it turns out this doesn't work, the order can be reversed. This will
41# perform the read IO twice, though, almost doubling the total installation
42# time.
43
44copy & remove "$@"
45
46set -x
47wait