mirror of
https://github.com/linuxboot/heads.git
synced 2025-02-11 13:15:17 +00:00
Add gui option to kexec-select-boot, use in gui-init menu option
When selecting the boot menu option (m) in the gui-init you call out to kexec-select-boot. To better maintain the graphical menu experience, I've added a -g option to kexec-select-boot that, when set, will use a graphical whiptail menu for the most common menu selection modes.
This commit is contained in:
parent
57405b0d28
commit
6ab78ae236
@ -82,7 +82,7 @@ while true; do
|
|||||||
if [ "$totp_confirm" = "m" ]; then
|
if [ "$totp_confirm" = "m" ]; then
|
||||||
# Try to select a kernel from the menu
|
# Try to select a kernel from the menu
|
||||||
mount_boot
|
mount_boot
|
||||||
kexec-select-boot -m -b /boot -c "grub.cfg"
|
kexec-select-boot -m -b /boot -c "grub.cfg" -g
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -12,7 +12,8 @@ valid_hash="n"
|
|||||||
valid_global_hash="n"
|
valid_global_hash="n"
|
||||||
valid_rollback="n"
|
valid_rollback="n"
|
||||||
force_menu="n"
|
force_menu="n"
|
||||||
while getopts "b:d:p:a:r:c:uim" arg; do
|
gui_menu="n"
|
||||||
|
while getopts "b:d:p:a:r:c:uimg" arg; do
|
||||||
case $arg in
|
case $arg in
|
||||||
b) bootdir="$OPTARG" ;;
|
b) bootdir="$OPTARG" ;;
|
||||||
d) paramsdev="$OPTARG" ;;
|
d) paramsdev="$OPTARG" ;;
|
||||||
@ -23,6 +24,7 @@ while getopts "b:d:p:a:r:c:uim" arg; do
|
|||||||
u) unique="y" ;;
|
u) unique="y" ;;
|
||||||
m) force_menu="y" ;;
|
m) force_menu="y" ;;
|
||||||
i) valid_hash="y"; valid_rollback="y" ;;
|
i) valid_hash="y"; valid_rollback="y" ;;
|
||||||
|
g) gui_menu="y" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -80,6 +82,24 @@ get_menu_option() {
|
|||||||
|
|
||||||
if [ $num_options -eq 1 -a $first_menu = "y" ]; then
|
if [ $num_options -eq 1 -a $first_menu = "y" ]; then
|
||||||
option_index=1
|
option_index=1
|
||||||
|
elif [ "$gui_menu" = "y" ]; then
|
||||||
|
MENU_OPTIONS=""
|
||||||
|
n=0
|
||||||
|
while read option
|
||||||
|
do
|
||||||
|
parse_option
|
||||||
|
n=`expr $n + 1`
|
||||||
|
name=$(echo $name | tr " " "_")
|
||||||
|
kernel=$(echo $kernel | cut -f2 -d " ")
|
||||||
|
MENU_OPTIONS="$MENU_OPTIONS $n ${name}_[$kernel]"
|
||||||
|
done < $TMP_MENU_FILE
|
||||||
|
|
||||||
|
whiptail --clear --title "Select your boot option" \
|
||||||
|
--menu "Choose the boot option [1-$n, a to abort]:" 20 120 8 \
|
||||||
|
-- $MENU_OPTIONS \
|
||||||
|
2>/tmp/whiptail || die "Aborting boot attempt"
|
||||||
|
|
||||||
|
option_index=$(cat /tmp/whiptail)
|
||||||
else
|
else
|
||||||
echo "+++ Select your boot option:"
|
echo "+++ Select your boot option:"
|
||||||
n=0
|
n=0
|
||||||
@ -105,6 +125,14 @@ get_menu_option() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
confirm_menu_option() {
|
confirm_menu_option() {
|
||||||
|
if [ "$gui_menu" = "y" ]; then
|
||||||
|
whiptail --clear --title "Confirm boot details" \
|
||||||
|
--menu "Confirm the boot details for $name:\n\n$option\n\n" 20 120 8 \
|
||||||
|
-- 'y' "Boot $name" 'd' "Make $name the default" \
|
||||||
|
2>/tmp/whiptail || die "Aborting boot attempt"
|
||||||
|
|
||||||
|
option_confirm=$(cat /tmp/whiptail)
|
||||||
|
else
|
||||||
echo "+++ Please confirm the boot details for $name:"
|
echo "+++ Please confirm the boot details for $name:"
|
||||||
echo $option
|
echo $option
|
||||||
|
|
||||||
@ -113,6 +141,7 @@ confirm_menu_option() {
|
|||||||
-p "Confirm selection by pressing 'y', make default with 'd': " \
|
-p "Confirm selection by pressing 'y', make default with 'd': " \
|
||||||
option_confirm
|
option_confirm
|
||||||
echo
|
echo
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_option() {
|
parse_option() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user