shell scripts to help rewrite Qubes initrd /etc/crypttab (issue #29)

This commit is contained in:
Trammell Hudson 2016-12-13 15:10:47 -05:00
parent 8ce1309102
commit ccea67e8b4
Failed to extract signature
2 changed files with 32 additions and 0 deletions

11
initrd/bin/generate-crypttab Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# Generate a crypttab file for all the devices that are
# present on the system. This is a total hack since the
# rd.luks.key=/secret.key should be sufficient.
keyfile=/secret.key
for dev in /dev/sd*; do
uuid=`cryptsetup luksUUID "$dev" 2>/dev/null` || continue
echo "luks-$uuid /dev/disk/by-uuid/$uuid $keyfile luks"
done

21
initrd/bin/wrap-cpio Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
# Add additional files to the initrd cpio so that we can pass
# new keys to the Qubes startup routines.
# Usage:
# wrap-cpio /boot/initrd.blah /tmp/root/ > /tmp/new.cpio
die() { echo >&2 "$@"; exit 1; }
warn() { echo >&2 "$@"; }
cpio_file="$1"
if [ -z "$cpio_file" ]; then
die "Initial cpio must be specified"
fi
new_dir="$2"
if [ -z "$new_dir" ]; then
die "Additional directory must be specified"
fi
( cd "$new_dir" ; find . | cpio -H newc -ov )
cat "$cpio_file"