All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Subject: [PATCH] manpages for everything
Date: Fri, 8 Feb 2008 22:29:00 +0100	[thread overview]
Message-ID: <20080208212900.GA30078@thorin> (raw)

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]


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 /.)

[-- Attachment #2: manpages.diff --]
[-- Type: text/x-diff, Size: 6766 bytes --]

2008-02-08  Robert Millan  <rmh@aybabtu.com>

	* 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 `grub-devel@gnu.org'
	with `bug-grub@gnu.org'.
	* 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 <bug-grub@gnu.org>.
 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 <bug-grub@gnu.org>.
 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 @@ platform=@platform@
 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 <bug-grub@gnu.org>.
+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
     :

             reply	other threads:[~2008-02-08 21:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-08 21:29 Robert Millan [this message]
2008-02-09  0:17 ` [PATCH] manpages for everything Robert Millan
2008-02-09  3:02   ` Jordi Mallach
2008-02-09 10:30     ` Robert Millan
2008-02-09 13:16       ` Jordi Mallach
2008-02-09 16:00         ` Robert Millan
2008-02-09 12:30 ` Robert Millan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080208212900.GA30078@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.