0

I have a GRUB configuration that looks like the following, where I would like to detect different key inputs so I can act accordingly, but this does not work by default:

echo ""
echo -n "server: "
echo -n $net_default_server
echo -n " client: "
net_ls_addr
echo ""
echo "--------------------------------------------------------------------------"
echo "                      Boot from disk in 5 seconds."
echo "Press [ENTER] for network boot. Press [TAB] for text mode network boot."
echo "--------------------------------------------------------------------------"

# this is modified sleep returning:
# 0 - timeout
# 1 - ESC
# 2 - TAB
# 3 - ENTER
sleep -i 5

set retcode=$?

clear

if [ $retcode == 1 ]; then
    exit
fi

if [ $retcode == 0 ]; then
    exit
fi

if [ $retcode == 3 ]; then
    terminal_output gfxterm
    set gfxmode="800x600;640x480;auto"
    set theme=theme.txt
fi


set color_normal=white/black
set color_highlight=black/white
set menu_color_normal=white/black
set menu_color_highlight=black/white
set timeout=15
set default='Exit to EFI Shell'
set fallback='Exit to EFI Shell'
set pager=1

menuentry 'Install CentOS 8 Linux x86_64 (C8)' {
 blah
}

This comes from a local grub patch I no longer have, hence my question: is this somehow possible? Even changing keys would do the trick.

djuarezg
  • 131
  • 1
  • 2
  • 8
  • This seems unnecessary. After all you can do whatever you want with normal grub menu entries. – Michael Hampton Sep 29 '20 at 16:25
  • @MichaelHampton well, the thing is that by default we try to pxe boot, so we get grub, if it times out we fallback to disk. At any given point people might want to select manually an entry from the menuentry list – djuarezg Sep 30 '20 at 15:22

0 Answers0