+2010-09-08 Yves Blusseau <blusseau@zetam.org>
+
+ Add new --boot-directory option to replace --root-directory
+
+ * util/grub-install.in: Add new --boot-directory option
+ * util/grub-reboot.in: Likewise.
+ * util/grub-set-default.in: Likewise.
+
2010-09-08 Yves Blusseau <blusseau@zetam.org>
* util/grub-mkconfig.in: Use new variable.
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
rootdir=
-grub_prefix=`echo /boot/grub | sed ${transform}`
+bootdir=
+grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
modules=
install_device=
-h, --help print this message and exit
-v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES
- --root-directory=DIR install GRUB images under the directory DIR
- instead of the root directory
+ --boot-directory=DIR install GRUB images under the directory DIR/@grubdirname@
+ instead of the $grubdir directory
--grub-setup=FILE use FILE as grub-setup
--grub-mkimage=FILE use FILE as grub-mkimage
--grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
INSTALL_DEVICE can be a GRUB device name or a system device filename.
-$self copies GRUB images into /boot/grub (or /grub on NetBSD and
-OpenBSD), and uses grub-setup to install grub into the boot sector.
-
-If the --root-directory option is used, then $self will copy
-images into the operating system installation rooted at that directory.
+$self copies GRUB images into $grubdir, and uses grub-setup
+to install grub into the boot sector.
Report bugs to <bug-grub@gnu.org>.
EOF
--font=*)
;;
+# Accept for compatibility
--root-directory)
rootdir=`argument $option "$@"`; shift;;
--root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
+ --boot-directory)
+ bootdir=`argument $option "$@"`; shift;;
+ --boot-directory=*)
+ bootdir=`echo "$option" | sed 's/--boot-directory=//'` ;;
+
--grub-setup)
grub_setup=`argument $option "$@"`; shift;;
--grub-setup=*)
setup_verbose="--verbose"
fi
-# Initialize these directories here, since ROOTDIR was initialized.
-case "$host_os" in
-netbsd* | openbsd*)
- # Because /boot is used for the boot block in NetBSD and OpenBSD, use /grub
- # instead of /boot/grub.
- grub_prefix=`echo /grub | sed ${transform}`
- bootdir=${rootdir}
- ;;
-*)
- # Use /boot/grub by default.
- bootdir=${rootdir}/boot
- ;;
-esac
+if [ -z "$bootdir" ]; then
+ # Default bootdir if bootdir not initialized.
+ bootdir=/@bootdirname@
-grubdir=${bootdir}/`echo grub | sed ${transform}`
-device_map=${grubdir}/device.map
+ if [ -n "$rootdir" ] ; then
+ # Initialize bootdir if rootdir was initialized.
+ bootdir=${rootdir}/@bootdirname@
+ fi
+fi
+grubdir=`echo "${bootdir}/@grubdirname@" | sed 's,//*,/,g'`
+device_map=${grubdir}/device.map
grub_probe="${grub_probe} --device-map=${device_map}"
# Check if GRUB is installed.
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
rootdir=
+bootdir=
+grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
# Usage: usage
# Print the usage.
-h, --help print this message and exit
-v, --version print the version information and exit
- --root-directory=DIR expect GRUB images under the directory DIR
- instead of the root directory
+ --boot-directory=DIR expect GRUB images under the directory DIR/@grubdirname@
+ instead of the $grubdir directory
ENTRY is a number or a menu item title.
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
+# Accept for compatibility
--root-directory)
rootdir=`argument $option "$@"`; shift ;;
--root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
+ --boot-directory)
+ bootdir=`argument $option "$@"`; shift;;
+ --boot-directory=*)
+ bootdir=`echo "$option" | sed 's/--boot-directory=//'` ;;
+
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
exit 1
fi
-# Initialize these directories here, since ROOTDIR was initialized.
-case "$host_os" in
-netbsd* | openbsd*)
- # Because /boot is used for the boot block in NetBSD and OpenBSD, use /grub
- # instead of /boot/grub.
- grub_prefix=`echo /grub | sed ${transform}`
- bootdir=${rootdir}
- ;;
-*)
- # Use /boot/grub by default.
- bootdir=${rootdir}/boot
- ;;
-esac
-
-grubdir=${bootdir}/`echo grub | sed ${transform}`
+if [ -z "$bootdir" ]; then
+ # Default bootdir if bootdir not initialized.
+ bootdir=/@bootdirname@
+
+ if [ -n "$rootdir" ] ; then
+ # Initialize bootdir if rootdir was initialized.
+ bootdir=${rootdir}/@bootdirname@
+ fi
+fi
+
+grubdir=`echo "${bootdir}/@grubdirname@" | sed 's,//*,/,g'`
prev_saved_entry=`$grub_editenv ${grubdir}/grubenv list | sed -n 's/^saved_entry=//p'`
if [ "$prev_saved_entry" ]; then
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
rootdir=
+bootdir=
+grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
# Usage: usage
# Print the usage.
-h, --help print this message and exit
-v, --version print the version information and exit
- --root-directory=DIR expect GRUB images under the directory DIR
- instead of the root directory
+ --boot-directory=DIR expect GRUB images under the directory DIR/@grubdirname@
+ instead of the $grubdir directory
ENTRY is a number or a menu item title.
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
+# Accept for compatibility
--root-directory)
rootdir=`argument $option "$@"`; shift ;;
--root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
+ --boot-directory)
+ bootdir=`argument $option "$@"`; shift;;
+ --boot-directory=*)
+ bootdir=`echo "$option" | sed 's/--boot-directory=//'` ;;
+
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
exit 1
fi
-# Initialize these directories here, since ROOTDIR was initialized.
-case "$host_os" in
-netbsd* | openbsd*)
- # Because /boot is used for the boot block in NetBSD and OpenBSD, use /grub
- # instead of /boot/grub.
- grub_prefix=`echo /grub | sed ${transform}`
- bootdir=${rootdir}
- ;;
-*)
- # Use /boot/grub by default.
- bootdir=${rootdir}/boot
- ;;
-esac
-
-grubdir=${bootdir}/`echo grub | sed ${transform}`
+if [ -z "$bootdir" ]; then
+ # Default bootdir if bootdir not initialized.
+ bootdir=/@bootdirname@
+
+ if [ -n "$rootdir" ] ; then
+ # Initialize bootdir if rootdir was initialized.
+ bootdir=${rootdir}/@bootdirname@
+ fi
+fi
+
+grubdir=`echo "${bootdir}/@grubdirname@" | sed 's,//*,/,g'`
$grub_editenv ${grubdir}/grubenv unset prev_saved_entry
$grub_editenv ${grubdir}/grubenv set saved_entry="$entry"