mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-22 14:22:26 +00:00
3eb62eed1a
As part of the config gui we want to be able to have the system define new config options without them being lost if the user makes their own changes in CBFS. To allow that this change creates a function initiated in init that combines all /etc/config* files into /tmp/config. All existing scripts have been changed to source /tmp/config instead of /etc/config. The config-gui.sh script now uses /etc/config.user to hold user configuration options but the combine_configs function will allow that to expand as others want to split configuration out further. As it stands here are the current config files: /etc/config -- Compiled-in configuration options /etc/config.user -- User preferences that override /etc/config /tmp/config -- Running config referenced by the BIOS, combination of existing configs
64 lines
1.3 KiB
Bash
Executable File
64 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
# Boot from a local disk installation
|
|
|
|
. /etc/functions
|
|
. /tmp/config
|
|
|
|
mount_boot()
|
|
{
|
|
# Mount local disk if it is not already mounted
|
|
if ! grep -q /boot /proc/mounts ; then
|
|
mount -o ro /boot \
|
|
|| recovery "Unable to mount /boot"
|
|
fi
|
|
}
|
|
|
|
|
|
# Confirm we have a good TOTP unseal and ask the user for next choice
|
|
while true; do
|
|
echo "y) Default boot"
|
|
echo "n) TOTP does not match"
|
|
echo "r) Recovery boot"
|
|
echo "u) USB boot"
|
|
echo "m) Boot menu"
|
|
|
|
if ! confirm_totp "Boot mode"; then
|
|
recovery 'Failed to unseal TOTP'
|
|
fi
|
|
|
|
if [ "$totp_confirm" = "r" ]; then
|
|
recovery "User requested recovery shell"
|
|
fi
|
|
|
|
if [ "$totp_confirm" = "n" ]; then
|
|
echo ""
|
|
echo "To correct clock drift: 'date -s HH:MM:SS'"
|
|
echo "and save it to the RTC: 'hwclock -w'"
|
|
echo "then reboot and try again"
|
|
echo ""
|
|
recovery "TOTP mismatch"
|
|
fi
|
|
|
|
if [ "$totp_confirm" = "u" ]; then
|
|
exec /bin/usb-init
|
|
continue
|
|
fi
|
|
|
|
if [ "$totp_confirm" = "m" ]; then
|
|
# Try to select a kernel from the menu
|
|
mount_boot
|
|
kexec-select-boot -m -b /boot -c "grub.cfg"
|
|
continue
|
|
fi
|
|
|
|
if [ "$totp_confirm" = "y" -o -n "$totp_confirm" ]; then
|
|
# Try to boot the default
|
|
mount_boot
|
|
kexec-select-boot -b /boot -c "grub.cfg" \
|
|
|| recovery "Failed default boot"
|
|
fi
|
|
|
|
done
|
|
|
|
recovery "Something failed during boot"
|