Well I have sorted the immediate issue L89 - it is in fact two issues, neither of which are down to your script but rather to the idiosyncracies of my BIOS.
Firstly the syslinux.cfg has
and
Code: Select all
label localhost
localboot -1
MENU HIDE
The
syslinux documentation warns that localboot does not work on all BIOSes - and mine is one of them. (This ought to result in "a different local boot method" if nothing it selected after the timeout.) I am not sure how useful a default this is tbh, presumably if you have plugged in a bootable disk and rebooted, it is because you want to boot from that disk and not in the usual way. But that comes from the syslinux.cfg on the .iso file, not your script.
Secondly, my usb keyboard was not being recognised, although both the BIOS stage and gentoo when it booted from the usb stick did recognise it.
The combination left me staring at a screen saying "press any key or..." in some frustration!
Commenting out the ontimeout setting in syslinux.cfg got the thing to boot after the timeout period and plugging in a PS/2 keyboard meant I could select a kernel to boot. I have now discovered that on some old BIOSes it is necessary to set "Enable legacy USB support" otherwise USB keyboards are not recognised during the boot process (ie after the BIOS has handed over to something else presumably, as it is recognised when fiddling with the BIOS settings). Of course my BIOS is one of these as well. There is an upgrade available (dated 2008...), I may give it a go.
So your script worked fine, but my cranky old server needed some tweaking.