/usr/sbin/grub-reboot is in grub 0.97-29ubuntu66.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | #!/bin/sh -e
NAME=grub-reboot
VERSION=0.01
if ! test -n "$1" || test "$1" = "-h" || test "$1" = "--help" ; then
echo $NAME
echo
echo "Reboots into the specified OS entry in menu.lst"
echo
echo "Usage: $0 entry [options to grub]"
echo " (where \"entry\" is the entry number in menu.lst)"
echo
exit
fi
if test "$1" = "-v" || test "$1" = "--version" ; then
echo $NAME $VERSION
exit
fi
if test "`whoami`" != "root" ; then
echo "You must be root"
exit
fi
abort() {
message=$@
echo >&2
echo -e "$message" >&2
echo >&2
exit 1
}
find_grub_dir ()
{
echo -n "Searching for GRUB installation directory ... " >&2
for d in $grub_dirs ; do
if [ -d "$d" ] ; then
grub_dir="$d"
break
fi
done
if [ -z "$grub_dir" ] ; then
abort "No GRUB directory found.\n###"
else
echo "found: $grub_dir" >&2
fi
echo $grub_dir
}
grub_dirs="/boot/grub /boot/boot/grub"
grub_dir=$(find_grub_dir)
config_file=$grub_dir/menu.lst
default_file=$grub_dir/default
default="$1" ; shift
grub --batch --config-file=$config_file $@ <<EOT
savedefault --once --default=$default
quit
EOT
echo "
#
#
#
#
#
#
#
#
#
#
# WARNING: If you want to edit this file directly, do not remove any line
# from this file, including this warning. Using \`grub-set-default\' is
# strongly recommended." >> $default_file
echo
echo -n "Do you want to reboot now? [y/N] "
read REBOOT
case $REBOOT in
y*|Y*) reboot ;;
esac
|