Hey, I just wrote manpages for everything!

Well, actually I wrote this patch that makes our build system probe for
help2man, and use it to generate a manpage automatically for each
utility. :-)

They can be a good substitute for the info manual we don't have yet, or
(in the future) a complement to it.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
2008-02-08  Robert Millan  <[EMAIL PROTECTED]>

	* configure.ac: Probe for `help2man'.
	* Makefile.in (builddir): New variable.
	(HELP2MAN): Likewise.  Set to `true' when @HELP2MAN@ doesn't provide it.
	(install-local): For every executable
	utility or script that is installed, invoke $(HELP2MAN) to install a
	manpage based on --help output.

	* util/i386/pc/grub-install.in: Move down `update-grub_lib' sourcing, so
	that it doesn't prevent --help from working in build tree.

	* util/i386/pc/grub-mkrescue.in (usage): Replace [EMAIL PROTECTED]'
	with [EMAIL PROTECTED]'.
	* util/powerpc/ieee1275/grub-mkrescue.in (usage): Likewise.
	* util/update-grub.in (usage): New function.
	Implement proper argument check, with support for --help and --version
	(as well as existing -y).

diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/configure.ac ./configure.ac
--- ../grub2/configure.ac	2008-02-04 20:56:11.000000000 +0100
+++ ./configure.ac	2008-02-08 20:51:30.000000000 +0100
@@ -115,8 +115,9 @@ AC_PROG_INSTALL
 AC_PROG_AWK
 AC_PROG_MAKE_SET
 
-# This is not a "must".
+# These are not a "must".
 AC_PATH_PROG(RUBY, ruby)
+AC_PATH_PROG(HELP2MAN, help2man)
 
 #
 # Checks for host programs.
diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/Makefile.in ./Makefile.in
--- ../grub2/Makefile.in	2008-02-04 20:56:11.000000000 +0100
+++ ./Makefile.in	2008-02-08 22:14:45.000000000 +0100
@@ -20,6 +20,7 @@ SHELL = /bin/sh
 transform = @program_transform_name@
 
 srcdir = @srcdir@
+builddir = @builddir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 prefix = @prefix@
@@ -71,6 +72,10 @@ OBJCOPY = @OBJCOPY@
 STRIP = @STRIP@
 NM = @NM@
 RUBY = @RUBY@
+HELP2MAN = @HELP2MAN@
+ifeq (, $(HELP2MAN))
+HELP2MAN = true
+endif
 AWK = @AWK@
 LIBCURSES = @LIBCURSES@
 LIBLZO = @LIBLZO@
@@ -157,27 +162,31 @@ install-local: all
 	  dest="`echo $$file | sed 's,.*/,,'`"; \
 	  $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkgdatadir)/$$dest; \
 	done
-	$(mkinstalldirs) $(DESTDIR)$(bindir)
+	$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)
 	@list='$(bin_UTILITIES)'; for file in $$list; do \
 	  if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
 	  dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
 	  $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
+	  $(HELP2MAN) --no-info $(builddir)/$$file > $(DESTDIR)$(mandir)/$$dest.1; \
 	done
-	$(mkinstalldirs) $(DESTDIR)$(sbindir)
+	$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)
 	@list='$(sbin_UTILITIES)'; for file in $$list; do \
 	  if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
 	  dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
 	  $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
+	  $(HELP2MAN) --no-info $(builddir)/$$file > $(DESTDIR)$(mandir)/$$dest.8; \
 	done
 	@list='$(bin_SCRIPTS)'; for file in $$list; do \
 	  if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
 	  dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
 	  $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
+	  $(HELP2MAN) --no-info $(builddir)/$$file > $(DESTDIR)$(mandir)/$$dest.1; \
 	done
 	@list='$(sbin_SCRIPTS)'; for file in $$list; do \
 	  if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
 	  dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
 	  $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
+	  $(HELP2MAN) --no-info $(builddir)/$$file > $(DESTDIR)$(mandir)/$$dest.8; \
 	done
 	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d
 	@list='$(update-grub_SCRIPTS)'; for file in $$list; do \
diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/i386/pc/grub-install.in ./util/i386/pc/grub-install.in
--- ../grub2/util/i386/pc/grub-install.in	2008-01-12 16:11:57.000000000 +0100
+++ ./util/i386/pc/grub-install.in	2008-02-08 22:03:01.000000000 +0100
@@ -45,9 +45,6 @@ force_lba=
 recheck=no
 debug=no
 
-# for make_system_path_relative_to_its_root()
-. ${libdir}/grub/update-grub_lib
-
 # Usage: usage
 # Print the usage.
 usage () {
@@ -120,6 +117,9 @@ for option in "$@"; do
     esac
 done
 
+# for make_system_path_relative_to_its_root()
+. ${libdir}/grub/update-grub_lib
+
 if test "x$install_device" = x; then
     echo "install_device not specified." 1>&2
     usage
diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/i386/pc/grub-mkrescue.in ./util/i386/pc/grub-mkrescue.in
--- ../grub2/util/i386/pc/grub-mkrescue.in	2008-02-03 19:31:02.000000000 +0100
+++ ./util/i386/pc/grub-mkrescue.in	2008-02-08 22:12:09.000000000 +0100
@@ -49,7 +49,7 @@ Make GRUB rescue image.
 
 grub-mkimage generates a bootable rescue image of the specified type.
 
-Report bugs to <grub-devel@gnu.org>.
+Report bugs to <[EMAIL PROTECTED]>.
 EOF
 }
 
diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/powerpc/ieee1275/grub-mkrescue.in ./util/powerpc/ieee1275/grub-mkrescue.in
--- ../grub2/util/powerpc/ieee1275/grub-mkrescue.in	2008-01-31 18:09:39.000000000 +0100
+++ ./util/powerpc/ieee1275/grub-mkrescue.in	2008-02-08 22:12:26.000000000 +0100
@@ -48,7 +48,7 @@ Make GRUB rescue image.
 
 grub-mkimage generates a bootable rescue CD image for PowerMac and CHRP.
 
-Report bugs to <grub-devel@gnu.org>.
+Report bugs to <[EMAIL PROTECTED]>.
 EOF
 }
 
diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/update-grub.in ./util/update-grub.in
--- ../grub2/util/update-grub.in	2008-01-12 16:11:56.000000000 +0100
+++ ./util/update-grub.in	2008-02-08 22:05:29.000000000 +0100
@@ -31,6 +31,41 @@ [EMAIL PROTECTED]@
 grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
 grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
 
+# Usage: usage
+# Print the usage.
+usage () {
+    cat <<EOF
+Usage: $0 [OPTION]
+Generate /boot/grub/grub.cfg
+
+  -h, --help              print this message and exit
+  -v, --version           print the version information and exit
+  -y                      ignored for compatibility
+
+Report bugs to <[EMAIL PROTECTED]>.
+EOF
+}
+
+# Check the arguments.
+for option in "$@"; do
+    case "$option" in
+    -h | --help)
+	usage
+	exit 0 ;;
+    -v | --version)
+	echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
+	exit 0 ;;
+    -y)
+        echo "$0: warning: Ignoring -y option (no longer needed)." >&2
+        ;;
+    -*)
+	echo "Unrecognized option \`$option'" 1>&2
+	usage
+	exit 1
+	;;
+    esac
+done
+
 # for convert_system_path_to_grub_path(), font_path()
 . ${libdir}/grub/update-grub_lib
 
@@ -43,10 +78,6 @@ if [ "$UID" != 0 ] ; then
   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
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to