gui-init: ensure /boot is sane first thing

Before anything else, ensure that a default boot device
is set. If not, prompt the user to set one.  If set, ensure
that /boot can be mounted successfully; else prompt the
user to select a new boot device.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
This commit is contained in:
Matt DeVillier 2019-05-27 11:45:09 -05:00
parent f772f2d088
commit 2686c836c6
No known key found for this signature in database
GPG Key ID: 2BBB776A35B978FD

View File

@ -8,10 +8,23 @@ CONFIG_BOOT_GUI_MENU_NAME='Heads Boot Menu'
mount_boot()
{
# ensure default boot device is set
if [ ! -e "$CONFIG_BOOT_DEV" ]; then
if (whiptail $CONFIG_ERROR_BG_COLOR --clear --title "ERROR: $CONFIG_BOOT_DEV missing!" \
--yesno "The /boot device $CONFIG_BOOT_DEV could not be found!\n\nYou will need to configure the correct device for /boot.\n\nWould you like to configure the /boot device now?" 30 90) then
config-gui.sh
fi
# 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"
elif ! grep -q /boot /proc/mounts ; then
mount -o ro /boot
if [ $? -ne 0 ]; then
if (whiptail $CONFIG_ERROR_BG_COLOR --clear --title 'ERROR: Cannot mount /boot' \
--yesno "The /boot partition at $CONFIG_BOOT_DEV could not be mounted!\n\nWould you like to configure the /boot device now?" 30 90) then
config-gui.sh
else
recovery "Unable to mount /boot"
fi
fi
fi
}
verify_global_hashes()
@ -104,6 +117,9 @@ update_totp()
/bin/reboot
}
# ensure /boot is sane and mount it before anything else
mount_boot
last_half=X
while true; do
MAIN_MENU_OPTIONS=""