On 2018-02-17, Grant Edwards <[email protected]> wrote:
> I'm trying to figure out how to configure grub 2.02 so that no menu is
> displayed and it will boot immediately to the default unless shift is
> held down during boot -- in which case it displays the menu and waits
> indefinitely for a choice to be made.
FWIW, the config file I ended up with is below. For a good laugh,
compare it with the 300-line monstrosity your favorite distro produces
auto-magically.
Despite grub2 documentation to the contrary, 'keystatus --shift' does
not always return true if the shift key is held down. In my testing
it only returns true if shift was up when grub started and _then_ was
pressed and held down. If you press shift before grub starts (and
hold it down) then 'keystatus --shift' returns false. [Maybe this is
HW dependent?]
That's why I added the double "A above middle C" beep followed by 1
second of silence: provides a window during which you can press the
shift key. I would prefer it if you could just press and hold the
shift key immediately after power-on, but it'll do.
----------------------------------------------------------------------
set root=(hd0,3)
insmod play
play 6000 440 10 0 20 440 10 0 100
set default=0
if keystatus --shift; then
set timeout=-1
set timeout_style=menu
else
set timeout=0
set timeout_style=hidden
fi
menuentry "Windows"{
[...]
}
menuentry "Recovery"{
[...]
}
----------------------------------------------------------------------
--
Grant Edwards grant.b.edwards Yow! I wonder if I ought
at to tell them about my
gmail.com PREVIOUS LIFE as a COMPLETE
STRANGER?