summaryrefslogtreecommitdiff
path: root/src/initrd/grok-block
diff options
context:
space:
mode:
Diffstat (limited to 'src/initrd/grok-block')
-rwxr-xr-xsrc/initrd/grok-block66
1 files changed, 2 insertions, 64 deletions
diff --git a/src/initrd/grok-block b/src/initrd/grok-block
index a7056ad..d194486 100755
--- a/src/initrd/grok-block
+++ b/src/initrd/grok-block
@@ -7,15 +7,6 @@ case "$DEVNAME" in /dev/loop*|/dev/ram*|/dev/dm-*|/dev/md*|/dev/fd*) exit ;; esa
7 7
8debug_log "grok-block.${DEVNAME##*/}" 8debug_log "grok-block.${DEVNAME##*/}"
9 9
10addmenu_choosekey()
11{
12 dev=$1
13 dir=$2
14 addmenu "$dev//$dir" \
15 "[ Use the GPG key on $dev ]" \
16 "menu-select boot-gpg $dev $dir"
17}
18
19addmenu_repairhfs() 10addmenu_repairhfs()
20{ 11{
21 local device="$1" 12 local device="$1"
@@ -87,26 +78,6 @@ retry_mount()
87 done 78 done
88} 79}
89 80
90Gpg2()
91{
92 gpg2 --lock-never --no-permission-warning --no-auto-check-trustdb --no-options "$@"
93}
94
95gpg_verify()
96{
97 [ -e "$1" ] || return
98 bootwait samizdat-gpg
99 export GNUPGHOME=/gpg/gnupghome
100 Gpg2 --verify "$1"
101}
102
103gpg_can_decrypt()
104{
105 [ -e "$1" ] || return
106 bootwait samizdat-gpg
107 Gpg2 --decrypt "$1" | Gpg2 --decrypt "$1" >/dev/null
108}
109
110is_lvm() 81is_lvm()
111{ 82{
112 for n in 0 1 2 3; do 83 for n in 0 1 2 3; do
@@ -229,21 +200,7 @@ grok_block()
229 # TODO: And what if we create partitions and then reboot the machine mid-install? 200 # TODO: And what if we create partitions and then reboot the machine mid-install?
230 201
231 elif [ "$ID_PART_ENTRY_NAME" = samizdat-rootfs ]; then 202 elif [ "$ID_PART_ENTRY_NAME" = samizdat-rootfs ]; then
232 : 203 bootdone samizdat-rootfs
233
234 elif [ "$ID_PART_ENTRY_NAME" = samizdat-keys ]; then
235 mkdir -p /gpg
236 cp -a "$mountpoint"/gnupghome /gpg/ && bootdone samizdat-gpg && bootdone samizdat-cdrom
237
238 elif [ "$ID_PART_ENTRY_NAME" = samizdat-plaintext ]; then
239 if gpg_verify "$mountpoint"/disk.key && gpg_can_decrypt "$mountpoint"/disk.key; then
240 umount "$mountpoint"
241 addmenu_choose_native_root "$(parent_device "$DEVNAME")"
242 bootdone key-mounted
243 else
244 umount "$mountpoint"
245 fi
246
247 elif [ "$DEVNAME" = /dev/nbd1 ]; then 204 elif [ "$DEVNAME" = /dev/nbd1 ]; then
248 # This is our rootfs, over the network 205 # This is our rootfs, over the network
249 umount "$mountpoint" 206 umount "$mountpoint"
@@ -307,25 +264,6 @@ eval "$(PATH=$PATH:/lib/udev vol_id "$DEVNAME" |
307 sed "s/'/'\\\\''/; s/=\(.*\)/='\1'/" 264 sed "s/'/'\\\\''/; s/=\(.*\)/='\1'/"
308)" 265)"
309 266
310CDROM_ID_FS_UUID_ENC='73256269-4002-4e42-adbd-0e49ed1c7438' 267grok_block &
311CDROM_ID_FS_LABEL_ENC=$(sed 's/ /\\x20/g' /lib/samizdat/vol_id.txt)
312if [ "$ID_FS_UUID_ENC" = "$CDROM_ID_FS_UUID_ENC" -o \
313 "$ID_FS_LABEL_ENC" = "$CDROM_ID_FS_LABEL_ENC" ]
314then
315 # Recognize and mount the Samizdat
316 if ! mountpoint -q /cdrom; then
317 mkdir -p /cdrom
318 . mdadm-dup.sh
319 dup_mount_cdrom "$DEVNAME" /cdrom && bootdone samizdat-cdrom
320 if [ -e /cdrom/gnupghome ]; then
321 # TODO: don't use first match
322 mkdir -p /gpg/gnupghome
323 cp /cdrom/gnupghome/* /gpg/gnupghome
324 bootdone samizdat-gpg
325 fi
326 fi
327else
328 grok_block &
329fi
330 268
331# vim:set et sw=2: 269# vim:set et sw=2: