mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 20:47:55 +00:00
Extract pause_automatic_boot() from gui-init to gui_functions
pause_automatic_boot() prompts that an automatic boot is about to occur and allows the user to interrupt it. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
This commit is contained in:
parent
5d7afa2e02
commit
b365f1324a
@ -357,18 +357,11 @@ check_gpg_key()
|
||||
prompt_auto_default_boot()
|
||||
{
|
||||
TRACE "Under /bin/gui-init:prompt_auto_default_boot"
|
||||
# save IFS before changing, restore after read
|
||||
IFS_DEF=$IFS
|
||||
IFS=''
|
||||
first_pass=false
|
||||
echo -e "\nHOTP verification success\n\n"
|
||||
read -t $CONFIG_AUTO_BOOT_TIMEOUT -s -n 1 -p "Automatic boot in $CONFIG_AUTO_BOOT_TIMEOUT seconds unless interrupted by keypress... "
|
||||
if [[ $? -ne 0 ]]; then
|
||||
IFS=$IFS_DEF
|
||||
if pause_automatic_boot; then
|
||||
echo -e "\n\nAttempting default boot...\n\n"
|
||||
attempt_default_boot
|
||||
fi
|
||||
IFS=$IFS_DEF
|
||||
}
|
||||
|
||||
show_main_menu()
|
||||
|
@ -2,6 +2,17 @@
|
||||
# Shell functions for common operations using fbwhiptail
|
||||
. /etc/functions
|
||||
|
||||
# Pause for the configured timeout before booting automatically. Returns 0 to
|
||||
# continue with automatic boot, nonzero if user interrupted.
|
||||
pause_automatic_boot()
|
||||
{
|
||||
if IFS= read -t "$CONFIG_AUTO_BOOT_TIMEOUT" -s -n 1 -p \
|
||||
"Automatic boot in $CONFIG_AUTO_BOOT_TIMEOUT seconds unless interrupted by keypress... "; then
|
||||
return 1 # Interrupt automatic boot
|
||||
fi
|
||||
return 0 # Continue with automatic boot
|
||||
}
|
||||
|
||||
mount_usb()
|
||||
{
|
||||
TRACE "under gui_functions:mount_usb"
|
||||
|
Loading…
Reference in New Issue
Block a user