[ipxe-devel] Select menu item by typing in its name
Matteo Guglielmi
Matteo.Guglielmi at dalco.ch
Wed Jan 22 20:25:17 UTC 2020
Thanks Michael!
Last question,
this is an ipxe script which I generate via php.
What I would also need to preserve is the timeout option of
the choose function so that if I do not type anything, the
predefined item kicks in.
Is this possible or not?
#!ipxe
set menu-timeout 10000
set menu-default local
set cluster_name BOB
:start
menu iPXE boot menu for => ${hostname} <= on ${cluster_name}
item --gap -- --------------------------------------------------------------------------
item local local
item install install
item rescue rescue
item rescuerw rescuerw
item reboot reboot
item --gap -- --------------------------------------------------------------------------
choose --timeout ${menu-timeout} --default ${menu-default} selected || exit
goto ${selected}
:local
# boot from first drive
sanboot --no-describe --drive 0x80
:install
set boot-path http://10.123.123.1/fai
initrd ${boot-path}/initrd
kernel ${boot-path}/vmlinuz
imgargs vmlinuz initrd=initrd ip=dhcp root=10.123.123.1:/srv/fai/nfsroot:vers=3 rootovl FAI_FLAGS=verbose,sshd,reboot FAI_ACTION=install consoleblank=0 nomodeset
boot
:rescue
set boot-path http://10.123.123.1/rescue
initrd ${boot-path}/initramfs
kernel ${boot-path}/vmlinuz
imgargs vmlinuz initrd=initramfs root=10.123.123.1:/srv/live/cos8:vers=3 rootovl rootflags=nolock selinux=0 divider=10 elevator=noop preempt=0 rdblacklist=nouveau nouveau.modeset=0 rdblacklist=radeon radeon.modeset=0 consoleblank=0 rdblacklist=ast net.ifnames=0 biosdevname=0 nomodeset
boot
:rescuerw
set boot-path http://10.123.123.1/rescue
initrd ${boot-path}/initramfs
kernel ${boot-path}/vmlinuz
imgargs vmlinuz initrd=initramfs root=10.123.123.1:/srv/live/cos8:vers=3 rw rootflags=nolock selinux=0 divider=10 elevator=noop preempt=0 rdblacklist=nouveau nouveau.modeset=0 rdblacklist=radeon radeon.modeset=0 consoleblank=0 rdblacklist=ast net.ifnames=0 biosdevname=0 nomodeset
boot
:reboot
reboot
________________________________
From: ipxe-devel <ipxe-devel-bounces at lists.ipxe.org> on behalf of Michael Brown <mcb30 at ipxe.org>
Sent: Wednesday, January 22, 2020 5:32:00 PM
To: ipxe-devel at lists.ipxe.org
Subject: Re: [ipxe-devel] Select menu item by typing in its name
On 22/01/2020 16:17, Matteo Guglielmi wrote:
> I'm looking for a quick answer about ipxe.
>
> Is it possible to setup ipxe similarly to syslinux's menu where I
> can simply type in the item name I need instead of selecting it in
> the nemu?
>
> I'm not talking about keyboard shortcuts, but just a plain complete
> item name.
You can use the "read" command to read an arbitrary string from the
user, then try using it as a "goto" target.
https://ipxe.org/cmd/read
https://ipxe.org/cmd/goto
Something like:
echo -n Choose item:
read item
goto ${item} || goto item_not_found
Michael
_______________________________________________
ipxe-devel mailing list
ipxe-devel at lists.ipxe.org
https://lists.ipxe.org/mailman/listinfo/ipxe-devel
More information about the ipxe-devel
mailing list