3 # Set a default boot entry for GRUB
4 # Copyright (C) 2004 Free Software Foundation, Inc.
6 # This file is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 # Initialize some variables.
31 Usage: grub-set-default [OPTION] entry
32 Set the default boot entry for GRUB.
34 -h, --help print this message and exit
35 -v, --version print the version information and exit
36 --root-directory=DIR Use the directory DIR instead of the root directory
38 ENTRY is a number or the special keyword \`default\'.
40 Report bugs to <bug-grub@gnu.org>.
44 # Check the arguments.
45 for option
in "$@"; do
51 echo "grub-set-default (GNU GRUB ${VERSION})"
54 rootdir
=`echo "$option" | sed 's/--root-directory=//'` ;;
56 echo "Unrecognized option \`$option'" 1>&2
61 if test "x$entry" != x
; then
62 echo "More than one entries?" 1>&2
66 # We don't care about what the user specified actually.
71 if test "x$entry" = x
; then
72 echo "entry not specified." 1>&2
77 # Determine the GRUB directory. This is different among OSes.
78 grubdir
=${rootdir}/boot
/grub
79 if test -d ${grubdir}; then
82 grubdir
=${rootdir}/grub
83 if test -d ${grubdir}; then
86 echo "No GRUB directory found under ${rootdir}/" 1>&2
91 file=${grubdir}/default
92 if test -f ${file}; then
108 # WARNING: If you want to edit this file directly, do not remove any line
109 # from this file, including this warning. Using \`grub-set-default\' is
110 # strongly recommended.