summaryrefslogtreecommitdiff
path: root/src/initrd
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2017-03-28 09:25:16 -0400
committerAndrew Cady <d@jerkface.net>2017-03-28 09:25:16 -0400
commit2b948633f002af0dd1e428bfeca0453cb6ac72c3 (patch)
tree93434cf607fdd35b3bda30ff74229af4502ca660 /src/initrd
parent49f70f198a0bd1b72ae05b76ba8c2a013aa9ec5b (diff)
use mountpoint /plaintext for samizdat-plaintext partition
Diffstat (limited to 'src/initrd')
-rw-r--r--src/initrd/btrfs-create.sh2
-rwxr-xr-xsrc/initrd/grok-block20
-rwxr-xr-xsrc/initrd/menu-select14
3 files changed, 23 insertions, 13 deletions
diff --git a/src/initrd/btrfs-create.sh b/src/initrd/btrfs-create.sh
index c076b9e..917f957 100644
--- a/src/initrd/btrfs-create.sh
+++ b/src/initrd/btrfs-create.sh
@@ -76,7 +76,7 @@ samizdat_movemounts()
76 fi 76 fi
77 mkdir /root/cdrom 77 mkdir /root/cdrom
78 mount -o move /cdrom /root/cdrom 78 mount -o move /cdrom /root/cdrom
79 umount /gpg 79 umount /plaintext
80 true 80 true
81} 81}
82 82
diff --git a/src/initrd/grok-block b/src/initrd/grok-block
index 1152584..d3fe7a2 100755
--- a/src/initrd/grok-block
+++ b/src/initrd/grok-block
@@ -136,14 +136,15 @@ grok_block()
136 esac 136 esac
137 137
138 # Skip partitions that we created. 138 # Skip partitions that we created.
139 # TODO: make these names more unique 139 # The name 'samizdat-plaintext' is recognized and used to add the menu entry, below.
140 case "$DEVNAME" in
141 # Avoid mouting this multiple times in case this script gets called multiple times,
142 # because while it's mounted, the dmsetup stuff will fail with device busy.
143 /dev/nbd0) [ -e /bootwait/samizdat-nbd-dev ] && return ;;
144 esac
140 case "$ID_PART_ENTRY_NAME" in 145 case "$ID_PART_ENTRY_NAME" in
141 samizdat-grub-incomplete|samizdat-plaintext-incomplete|samizdat-luks-encrypted-incomplete) return ;; 146 samizdat-grub-incomplete|samizdat-plaintext-incomplete|samizdat-luks-encrypted-incomplete) return ;;
142 samizdat-grub|samizdat-plaintext|samizdat-luks-encrypted) 147 samizdat-grub|samizdat-luks-encrypted) return ;;
143 # TODO: Possibly only some of these are complete
144 addmenu_choose_native_root "$(parent_device "$DEVNAME")"
145 return
146 ;;
147 esac 148 esac
148 149
149 if [ "$ID_FS_TYPE" = hfsplus ] && ! fsck.hfsplus -q "$DEVNAME"; then 150 if [ "$ID_FS_TYPE" = hfsplus ] && ! fsck.hfsplus -q "$DEVNAME"; then
@@ -168,6 +169,13 @@ grok_block()
168 # TODO: Need option to boot the partitions we create 169 # TODO: Need option to boot the partitions we create
169 # TODO: And what if we create partitions and then reboot the machine mid-install? 170 # TODO: And what if we create partitions and then reboot the machine mid-install?
170 171
172 elif [ "$ID_PART_ENTRY_NAME" = samizdat-plaintext ]; then
173 # TODO: First ensure we can decrypt the key
174 if [ -e "$mountpoint"/disk.key ]; then
175 addmenu_choose_native_root "$(parent_device "$DEVNAME")"
176 fi
177 umount "$mountpoint"
178
171 elif [ "$DEVNAME" = /dev/nbd0 ]; then 179 elif [ "$DEVNAME" = /dev/nbd0 ]; then
172 # This is our rootfs, over the network 180 # This is our rootfs, over the network
173 umount "$mountpoint" 181 umount "$mountpoint"
diff --git a/src/initrd/menu-select b/src/initrd/menu-select
index 4c921b0..8347c28 100755
--- a/src/initrd/menu-select
+++ b/src/initrd/menu-select
@@ -88,10 +88,11 @@ case "$1" in
88 partition_new_hard_drive_DESTROYING_EVERYTHING "$dev" || error 88 partition_new_hard_drive_DESTROYING_EVERYTHING "$dev" || error
89 89
90 mkfs.btrfs -f "$dev"2 || error 90 mkfs.btrfs -f "$dev"2 || error
91 mount "$dev"2 /gpg || error 91 mkdir /plaintext
92 mount "$dev"2 /plaintext || error
92 init_gpg || error 93 init_gpg || error
93 94
94 init_samizdat_blockdev "$dev"3 /gpg/disk.key || error 95 init_samizdat_blockdev "$dev"3 /plaintext/disk.key || error
95 init_samizdat /dev/mapper/samizdatcrypt '' || error 96 init_samizdat /dev/mapper/samizdatcrypt '' || error
96 97
97 mark_partitions_as_complete "$dev" 98 mark_partitions_as_complete "$dev"
@@ -100,10 +101,11 @@ case "$1" in
100 ;; 101 ;;
101 boot-native) 102 boot-native)
102 dev="$2" 103 dev="$2"
103 init_gpg || error 104 init_gpg || error
104 mount "$dev"2 /gpg || error 105 mkdir /plaintext
105 open_samizdat_blockdev "$dev"3 /gpg/disk.key || error 106 mount "$dev"2 /plaintext || error
106 open_samizdat || error 107 open_samizdat_blockdev "$dev"3 /plaintext/disk.key || error
108 open_samizdat || error
107 bootdone root-mounted 109 bootdone root-mounted
108 ;; 110 ;;
109 boot-overwrite|boot-new|boot-luks) 111 boot-overwrite|boot-new|boot-luks)