]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Make --version uniform and avoid hard-coded program name.
authorGrégoire Sutre <gregoire.sutre@gmail.com>
Tue, 8 Jun 2010 10:52:42 +0000 (12:52 +0200)
committerGrégoire Sutre <gregoire.sutre@gmail.com>
Tue, 8 Jun 2010 10:52:42 +0000 (12:52 +0200)
12 files changed:
ChangeLog
util/grub-install.in
util/grub-mkconfig.in
util/grub-mkimage.c
util/grub-mkrescue.in
util/grub-reboot.in
util/grub-set-default.in
util/i386/efi/grub-install.in
util/i386/pc/grub-setup.c
util/ieee1275/grub-install.in
util/powerpc/ieee1275/grub-mkrescue.in
util/sparc64/ieee1275/grub-setup.c

index 45637ac173dd367cf154d98165aef32dbc6e84dd..9bbeae6c222ae657389c0f6dadd5f85334aa06cd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+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
index 0db216fd51fc05851d8116d18d5b25d8a1f73025..1e7fc1f2e5342cc9b92f27eec6321916585a8ad8 100644 (file)
@@ -34,6 +34,8 @@ font=@datadir@/@PACKAGE_TARNAME@/ascii.pf2
 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}`
@@ -61,7 +63,7 @@ fi
 # 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
@@ -91,10 +93,10 @@ fi
 
 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>.
@@ -108,7 +110,7 @@ for option in "$@"; do
        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=//'` ;;
index 0095e1ce870de7e19ac42283679515da63a9fd36..d916459d6a511afa2b64efd8e7985a5be8aa6e33 100644 (file)
@@ -23,7 +23,8 @@ exec_prefix=@exec_prefix@
 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@
@@ -31,6 +32,8 @@ pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
 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}`
 
@@ -38,7 +41,7 @@ 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]
@@ -62,7 +65,7 @@ for option in "$@"; do
        usage
        exit 0 ;;
     -v | --version)
-       echo "$0 (GNU GRUB ${package_version})"
+       echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
        exit 0 ;;
     -o)
        next_grub_cfg=:
@@ -113,7 +116,7 @@ if [ "$EUID" != 0 ] ; then
       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
@@ -284,7 +287,7 @@ cat << EOF
 #
 # 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
index 4e39450dfa17a9c3ebaa684591ead382fd3ed0bf..7b03c2fd0c8cf921269a25302b05de225525e24e 100644 (file)
@@ -1307,7 +1307,7 @@ main (int argc, char *argv[])
            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':
index 99b10de7b7149c147126d509ef8f64f364b1cdb4..61b0c94f7c49da5b7e90acb904f236a78a5c6c1a 100644 (file)
@@ -30,6 +30,8 @@ target_cpu=@target_cpu@
 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
@@ -44,7 +46,7 @@ grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
 # 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
@@ -54,7 +56,7 @@ Make GRUB rescue image.
   --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
@@ -67,7 +69,7 @@ for option in "$@"; do
        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=//'` ;;
index 20f2b10bcef721a36367d95763c09bcbb965860d..2c49f5e130dda52336fad4c8baa45ef1aef22eaf 100644 (file)
@@ -22,6 +22,10 @@ transform="@program_transform_name@"
 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=
@@ -30,7 +34,7 @@ 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
@@ -51,7 +55,7 @@ for option in "$@"; do
        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=//'` ;;
index 4d7c10e8efc702c089e362edfb29bf639a62c4f4..d8059bfaa854ef4e66c65b6e3e8728a3215a2952 100644 (file)
@@ -22,6 +22,10 @@ transform="@program_transform_name@"
 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=
@@ -30,7 +34,7 @@ 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
@@ -51,7 +55,7 @@ for option in "$@"; do
        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=//'` ;;
index 9b4270ff6bb5c4b78e904c40bb1c12cd1c7a2b19..25838148529e29030e37549aa6f497013142efb3 100644 (file)
@@ -33,6 +33,8 @@ host_os=@host_os@
 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}`
@@ -50,7 +52,7 @@ debug=no
 # 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
@@ -64,7 +66,7 @@ Install GRUB on your EFI partition.
   --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>.
@@ -78,7 +80,7 @@ for option in "$@"; do
        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=//'` ;;
@@ -219,7 +221,7 @@ $grub_mkimage -O ${target_cpu}-efi --output=${grubdir}/grub.efi $modules || exit
 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
index 08a76f65cb22453f13bb956c5b829a29d274885e..ef0f5a990d3e022d9f6da1ef014fe0c50b4f21f5 100644 (file)
@@ -702,7 +702,7 @@ main (int argc, char *argv[])
            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':
index 4d00cc2176a550ffe3063f72c264ed109c43165d..72135213dc6a59ceddd5f163c304af74947b90e4 100644 (file)
@@ -34,6 +34,8 @@ target_cpu=@target_cpu@
 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}`
@@ -53,7 +55,7 @@ nvsetenv=`which nvsetenv`
 # 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
@@ -66,7 +68,7 @@ Install GRUB on your drive.
   --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.
 
@@ -81,7 +83,7 @@ for option in "$@"; do
        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=//'` ;;
@@ -231,7 +233,7 @@ fi
 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
index 16658505b481e919627f6de4c16ad4b47b38c79e..d79627862ff06b2717af338b82773b38e8b83e93 100644 (file)
@@ -30,13 +30,15 @@ target_cpu=@target_cpu@
 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
@@ -46,7 +48,7 @@ Make GRUB rescue image.
                           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
@@ -61,7 +63,7 @@ for option in "$@"; do
        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=//'` ;;
index 8a2d30ba111ddd404464582009a975725246e619..93e135eb3ced70cea2ce4ed4009f12e2377c053e 100644 (file)
@@ -503,7 +503,7 @@ parse_options (struct grub_setup_info *gp, int argc, char *argv[])
            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':