heads/initrd/bin/usb-iso-init
Francis Lam efd662c63a
adds a USB boot option with basic parsing to kexec
Supports booting from USB media using either the root device or
a signed ISO as the boot device.  Boot options are parsed with
quick/dirty shell scripts to infer kexec params.

Closes #195 and begins to address #196
2017-04-29 13:40:34 -04:00

28 lines
544 B
Bash
Executable File

#!/bin/sh
# Boot from signed ISO
. /etc/functions
. /etc/config
ISO="$1"
echo '+++ Verifying ISO'
# Verify the signature on the hashes
ISOSIG="$ISO.sig"
if ! [ -r "$ISOSIG" ]; then
ISOSIG="$ISO.asc"
fi
gpgv "$ISOSIG" "$ISO" \
|| recovery 'ISO signature failed'
echo '+++ Mounting ISO and booting'
mount -t iso9660 -o loop $ISO /boot
ISO_FILE=${ISO:7}
DEV=$CONFIG_USB_BOOT_DEV
DEV_UUID=`blkid $DEV | tail -1 | tr " " "\n" | grep UUID | cut -d\" -f2`
ADD="fromiso=/dev/disk/by-uuid/$DEV_UUID/$ISO_FILE"
/bin/usb-select-boot /boot "$ADD"