mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-26 08:01:06 +00:00
66 lines
1.3 KiB
Plaintext
66 lines
1.3 KiB
Plaintext
|
#!/bin/sh
|
||
|
# Boot a Tails installation
|
||
|
|
||
|
. /etc/functions
|
||
|
. /etc/config
|
||
|
|
||
|
# Confirm we have a good TOTP unseal
|
||
|
if ! confirm_totp ; then
|
||
|
recovery 'Failed to unseal TOTP'
|
||
|
fi
|
||
|
|
||
|
# Extend PCR4 as soon as possible
|
||
|
tpm extend -ix 4 -ic usb
|
||
|
|
||
|
if [ ! "$totp_confirm" = "y" ]; then
|
||
|
recovery "Failed to confirm validity of TOTP"
|
||
|
fi
|
||
|
|
||
|
# TODO: Do a scan of USB devices to detect the Tails USB
|
||
|
mount-usb "$CONFIG_USB_BOOT_DEV"
|
||
|
|
||
|
# Check for ISO first
|
||
|
get_menu_option() {
|
||
|
echo "+++ Select your ISO boot option:"
|
||
|
n=0
|
||
|
while read option
|
||
|
do
|
||
|
n=`expr $n + 1`
|
||
|
echo "$n. $option"
|
||
|
done < /tmp/iso_menu.txt
|
||
|
|
||
|
read \
|
||
|
-p "Choose the ISO boot option [1-$n, s for standard boot, a to abort]: " \
|
||
|
option_index
|
||
|
|
||
|
if [ "$option_index" = "a" ]; then
|
||
|
recovery "Aborting boot attempt"
|
||
|
fi
|
||
|
|
||
|
if [ "$option_index" = "s" ]; then
|
||
|
option=""
|
||
|
return
|
||
|
fi
|
||
|
|
||
|
option=`head -n $option_index /tmp/iso_menu.txt | tail -1`
|
||
|
}
|
||
|
|
||
|
# create ISO menu options
|
||
|
ls -1r /media/*.iso 2>/dev/null > /tmp/iso_menu.txt
|
||
|
if [ `wc -l /tmp/iso_menu.txt | cut -d\ -f1` -gt 0 ]; then
|
||
|
option_confirm=""
|
||
|
while [ -z "$option" -a "$option_index" != "s" ]
|
||
|
do
|
||
|
get_menu_option
|
||
|
done
|
||
|
|
||
|
if [ -n "$option" ]; then
|
||
|
exec usb-iso-init $option
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
echo "!!! Could not find any ISO, trying bootable USB"
|
||
|
exec usb-select-boot /media
|
||
|
|
||
|
recovery "Something failed..."
|