+2010-06-08 Grégoire Sutre <gregoire.sutre@gmail.com>
+
+ Make --version uniform and avoid hard-coded program name.
+
+ * util/grub-mkimage.c (main): Use `program_name' instead of
+ hard-coded string.
+ * util/i386/pc/grub-setup.c (main): Likewise.
+ * util/sparc64/ieee1275/grub-setup.c (parse_options): Likewise.
+ * util/grub-install.in: Save the basename of $0 in $self, and use the
+ latter in informational messages. Use the same format for --version
+ as the binary programs.
+ * util/grub-mkconfig.in: Likewise.
+ * util/grub-mkrescue.in: Likewise.
+ * util/grub-reboot.in: Likewise.
+ * util/grub-set-default.in: Likewise.
+ * util/i386/efi/grub-install.in: Likewise.
+ * util/ieee1275/grub-install.in: Likewise.
+ * util/powerpc/ieee1275/grub-mkrescue.in: Likewise.
+
2010-06-08 Grégoire Sutre <gregoire.sutre@gmail.com>
* util/i386/pc/grub-setup.c (setup): Use absolute offsets for start of
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
localedir=@datadir@/locale
+self=`basename $0`
+
grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
# Print the usage.
usage () {
cat <<EOF
-Usage: grub-install [OPTION] install_device
+Usage: $self [OPTION] install_device
Install GRUB on your drive.
-h, --help print this message and exit
INSTALL_DEVICE can be a GRUB device name or a system device filename.
-grub-install copies GRUB images into /boot/grub (or /grub on NetBSD and
+$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 grub-install will copy
+If the --root-directory option is used, then $self will copy
images into the operating system installation rooted at that directory.
Report bugs to <bug-grub@gnu.org>.
usage
exit 0 ;;
-v | --version)
- echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
+ echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
sbindir=@sbindir@
libdir=@libdir@
sysconfdir=@sysconfdir@
-package_version=@PACKAGE_VERSION@
+PACKAGE_NAME=@PACKAGE_NAME@
+PACKAGE_VERSION=@PACKAGE_VERSION@
host_os=@host_os@
datarootdir=@datarootdir@
datadir=@datadir@
grub_cfg=""
grub_mkconfig_dir=${sysconfdir}/grub.d
+self=`basename $0`
+
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
# Print the usage.
usage () {
cat <<EOF
-Usage: $0 [OPTION]
+Usage: $self [OPTION]
Generate a grub config file
-o, --output=FILE output generated config to FILE [default=stdout]
usage
exit 0 ;;
-v | --version)
- echo "$0 (GNU GRUB ${package_version})"
+ echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
-o)
next_grub_cfg=:
done ;;
esac
if [ $root != t ] ; then
- echo "$0: You must run this as root" >&2
+ echo "$self: You must run this as root" >&2
exit 1
fi
fi
#
# DO NOT EDIT THIS FILE
#
-# It is automatically generated by $0 using templates
+# It is automatically generated by $self using templates
# from ${grub_mkconfig_dir} and settings from ${sysconfdir}/default/grub
#
EOF
break;
case 'V':
- printf ("grub-mkimage (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION);
+ printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0;
case 'v':
native_platform=@platform@
pkglib_DATA="@pkglib_DATA@"
+self=`basename $0`
+
multiboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-multiboot
coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-coreboot
qemu_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-qemu
# Print the usage.
usage () {
cat <<EOF
-Usage: $0 [OPTION] SOURCE...
+Usage: $self [OPTION] SOURCE...
Make GRUB rescue image.
-h, --help print this message and exit
--rom-directory=DIR save rom images in DIR [optional]
--grub-mkimage=FILE use FILE as grub-mkimage
-$0 generates a bootable rescue image with specified source files or directories.
+$self generates a bootable rescue image with specified source files or directories.
Report bugs to <bug-grub@gnu.org>.
EOF
usage
exit 0 ;;
-v | --version)
- echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
+ echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
+PACKAGE_NAME=@PACKAGE_NAME@
+PACKAGE_VERSION=@PACKAGE_VERSION@
+
+self=`basename $0`
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
rootdir=
# Print the usage.
usage () {
cat <<EOF
-Usage: $0 [OPTION] entry
+Usage: $self [OPTION] entry
Set the default boot entry for GRUB, for the next boot only.
-h, --help print this message and exit
usage
exit 0 ;;
-v | --version)
- echo "grub-reboot (GNU GRUB ${PACKAGE_VERSION})"
+ echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
+PACKAGE_NAME=@PACKAGE_NAME@
+PACKAGE_VERSION=@PACKAGE_VERSION@
+
+self=`basename $0`
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
rootdir=
# Print the usage.
usage () {
cat <<EOF
-Usage: $0 [OPTION] entry
+Usage: $self [OPTION] entry
Set the default boot entry for GRUB.
-h, --help print this message and exit
usage
exit 0 ;;
-v | --version)
- echo "grub-set-default (GNU GRUB ${PACKAGE_VERSION})"
+ echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
localedir=@datadir@/locale
+self=`basename $0`
+
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
# Print the usage.
usage () {
cat <<EOF
-Usage: grub-install [OPTION]
+Usage: $self [OPTION]
Install GRUB on your EFI partition.
-h, --help print this message and exit
--no-floppy do not probe any floppy drive
--recheck probe a device map even if it already exists
-grub-install copies GRUB images into the DIR/boot directory specified by
+$self copies GRUB images into the DIR/boot directory specified by
--root-directory.
Report bugs to <bug-grub@gnu.org>.
usage
exit 0 ;;
-v | --version)
- echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
+ echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
echo "Installation finished. No error reported."
echo "This is the contents of the device map $device_map."
echo "Check if this is correct or not. If any of the lines is incorrect,"
-echo "fix it and re-run the script \`grub-install'."
+echo "fix it and re-run the script \`$self'."
echo
cat $device_map
break;
case 'V':
- printf ("grub-setup (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION);
+ printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0;
case 'v':
platform=@platform@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
+self=`basename $0`
+
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
# Print the usage.
usage () {
cat <<EOF
-Usage: grub-install [OPTION] [install_device]
+Usage: $self [OPTION] [install_device]
Install GRUB on your drive.
-h, --help print this message and exit
--grub-probe=FILE use FILE as grub-probe
--no-nvram don't update the boot-device NVRAM variable
-grub-install copies GRUB images into the DIR/boot directory specified by
+$self copies GRUB images into the DIR/boot directory specified by
--root-directory, and uses nvsetenv to set the Open Firmware boot-device
variable.
usage
exit 0 ;;
-v | --version)
- echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
+ echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
echo "Installation finished. No error reported."
echo "This is the contents of the device map $device_map."
echo "Check if this is correct or not. If any of the lines is incorrect,"
-echo "fix it and re-run the script \`grub-install'."
+echo "fix it and re-run the script \`$self'."
echo
cat $device_map
platform=@platform@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
+self=`basename $0`
+
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
# Usage: usage
# Print the usage.
usage () {
cat <<EOF
-Usage: grub-mkrescue [OPTION] output_image
+Usage: $self [OPTION] output_image
Make GRUB rescue image.
-h, --help print this message and exit
default: ${pkglibdir}
--grub-mkimage=FILE use FILE as grub-mkimage
-grub-mkimage generates a bootable rescue CD image for PowerMac and CHRP.
+$self generates a bootable rescue CD image for PowerMac and CHRP.
Report bugs to <bug-grub@gnu.org>.
EOF
usage
exit 0 ;;
-v | --version)
- echo "grub-mkrescue (GNU GRUB ${PACKAGE_VERSION})"
+ echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
break;
case 'V':
- printf ("grub-setup (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION);
+ printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0;
case 'v':