Hello,
I've noticed that update-grub doesn't handle usual options (especially
-h and --help).
Here's a patch that fix it.
(it also remove a blank space in #!/bin/sh header)
Franklin
--- update-grub.orig 2008-01-27 12:49:41.000000000 +0100
+++ update-grub.new 2008-01-27 12:56:10.000000000 +0100
@@ -1,5 +1,4 @@
-#! /bin/sh -e
-
+#!/bin/sh -e
# Generate grub.cfg by inspecting /boot contents.
# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
#
@@ -22,6 +21,9 @@
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
grub_prefix=`echo /boot/grub | sed ${transform}`
grub_cfg=${grub_prefix}/grub.cfg
@@ -34,6 +36,47 @@
# for convert_system_path_to_grub_path(), font_path()
. ${libdir}/grub/update-grub_lib
+# Usage: usage
+# Print the usage.
+usage () {
+ cat <<EOF
+Usage: update-grub [OPTION]
+Generate grub.cfg by inspecting /boot contents
+
+ -h, --help print this message and exit
+ -v, --version print the version information and exit
+ -y an old option. Ignored for compatibility
+
+update-grub generates grub.cfg, according to preferences in /etc/default/grub
+and by inspecting /boot contents.
+
+Report bugs to <[EMAIL PROTECTED]>.
+EOF
+}
+
+# Check the arguments.
+for option in "$@"; do
+ case "$option" in
+ -h | --help)
+ usage
+ exit 0 ;;
+ -v | --version)
+ echo "update-grub (GNU GRUB ${PACKAGE_VERSION})"
+ exit 0 ;;
+ -y)
+ echo "$0: warning: Ignoring -y option (no longer needed)." >&2
+ -*)
+ echo "$0: warning: Unrecognized option \`$option'" 1>&2
+ usage
+ exit 1
+ ;;
+ *)
+ echo "$0: warning: Unexpected argument \`$option'" 1>&2
+ usage
+ exit 1
+ esac
+done
+
if [ "x$UID" = "x" ] ; then
UID=`id -u`
fi
@@ -43,10 +86,6 @@
exit 1
fi
-if [ "$1" = "-y" ] ; then
- echo "$0: warning: Ignoring -y option (no longer needed)." >&2
-fi
-
set $grub_mkdevicemap dummy
if test -f "$1"; then
:
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel