There is an undocumented flag, which is mentioned in the GRUB package changelog. Together with GRUB shell batch mode, you can use it to simulate lilo -R:
Yes, this cropped up a couple of moths ago; find the option no. of the boot you wnat from the grub.conf (same value you'd use in its 'default' line).
John Haxby posted the following script, a tinkered vcersion of which works a treat for me at home:
#!/bin/bash
if [ $(id -u) -ne 0 ]; then echo "${0##*/}: must be superuser" >&2 exit 1 fi
IFS="
"
set $(awk '$1 == "title" {sub(/^title[ ]*/, ""); print $0;}' /boot/grub/grub.conf)
PS3="boot? "
select boot
do
if [ -n "$boot" ]
then number=$((REPLY-1))
echo "savedefault --default=$number --once" | grub --no-curses --device-map=/boot/grub/device.map >/dev/null
# exec reboot
fi
break
done
-- [neil@xxx ~]# rm -f .signature [neil@xxx ~]# ls -l .signature ls: .signature: No such file or directory [neil@xxx ~]# exit