diff --git a/ChangeLog b/ChangeLog index 7e84a1ec8..6de01cff1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,24 @@ -2008-02-08 Christian Franke +2008-02-09 Robert Millan + + * configure.ac: Probe for `help2man'. + * Makefile.in (builddir): New variable. + (HELP2MAN): Likewise. Set to `true' when @HELP2MAN@ doesn't provide it, + or otherwise add a few flags/options to 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). + +2008-02-09 Christian Franke * commands/cat.c (grub_cmd_cat): Print '\r' as hex to avoid overwriting previous output. diff --git a/Makefile.in b/Makefile.in index ba0757795..c2f432ff3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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,12 @@ OBJCOPY = @OBJCOPY@ STRIP = @STRIP@ NM = @NM@ RUBY = @RUBY@ +HELP2MAN = @HELP2MAN@ +ifeq (, $(HELP2MAN)) +HELP2MAN = true +else +HELP2MAN := LANG=C $(HELP2MAN) --no-info --source=FSF +endif AWK = @AWK@ LIBCURSES = @LIBCURSES@ LIBLZO = @LIBLZO@ @@ -157,27 +164,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)/man1 @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) --section=1 $(builddir)/$$file > $(DESTDIR)$(mandir)/man1/$$dest.1; \ done - $(mkinstalldirs) $(DESTDIR)$(sbindir) + $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8 @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) --section=8 $(builddir)/$$file > $(DESTDIR)$(mandir)/man8/$$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) --section=1 $(builddir)/$$file > $(DESTDIR)$(mandir)/man1/$$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) --section=8 $(builddir)/$$file > $(DESTDIR)$(mandir)/man8/$$dest.8; \ done $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d @list='$(update-grub_SCRIPTS)'; for file in $$list; do \ diff --git a/configure b/configure index 99e2eede1..9177d9c7d 100644 --- a/configure +++ b/configure @@ -674,6 +674,7 @@ INSTALL_DATA AWK SET_MAKE RUBY +HELP2MAN CC CFLAGS LDFLAGS @@ -2237,7 +2238,7 @@ echo "${ECHO_T}no" >&6; } fi -# This is not a "must". +# These are not a "must". # Extract the first word of "ruby", so it can be a program name with args. set dummy ruby; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 @@ -2278,6 +2279,46 @@ echo "${ECHO_T}no" >&6; } fi +# Extract the first word of "help2man", so it can be a program name with args. +set dummy help2man; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_HELP2MAN+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $HELP2MAN in + [\\/]* | ?:[\\/]*) + ac_cv_path_HELP2MAN="$HELP2MAN" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_HELP2MAN="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +HELP2MAN=$ac_cv_path_HELP2MAN +if test -n "$HELP2MAN"; then + { echo "$as_me:$LINENO: result: $HELP2MAN" >&5 +echo "${ECHO_T}$HELP2MAN" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + # # Checks for host programs. @@ -8844,6 +8885,7 @@ INSTALL_DATA!$INSTALL_DATA$ac_delim AWK!$AWK$ac_delim SET_MAKE!$SET_MAKE$ac_delim RUBY!$RUBY$ac_delim +HELP2MAN!$HELP2MAN$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim @@ -8870,7 +8912,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 83; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 84; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.ac b/configure.ac index 73f60875f..38c957243 100644 --- a/configure.ac +++ b/configure.ac @@ -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 --git a/util/i386/pc/grub-install.in b/util/i386/pc/grub-install.in index 4428816fa..34e98e9f4 100644 --- a/util/i386/pc/grub-install.in +++ b/util/i386/pc/grub-install.in @@ -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 --git a/util/i386/pc/grub-mkrescue.in b/util/i386/pc/grub-mkrescue.in index 835f73189..620c0f093 100644 --- a/util/i386/pc/grub-mkrescue.in +++ b/util/i386/pc/grub-mkrescue.in @@ -49,7 +49,7 @@ Make GRUB rescue image. grub-mkimage generates a bootable rescue image of the specified type. -Report bugs to . +Report bugs to . EOF } diff --git a/util/powerpc/ieee1275/grub-mkrescue.in b/util/powerpc/ieee1275/grub-mkrescue.in index 61495abcd..8e72eac8b 100644 --- a/util/powerpc/ieee1275/grub-mkrescue.in +++ b/util/powerpc/ieee1275/grub-mkrescue.in @@ -48,7 +48,7 @@ Make GRUB rescue image. grub-mkimage generates a bootable rescue CD image for PowerMac and CHRP. -Report bugs to . +Report bugs to . EOF } diff --git a/util/update-grub.in b/util/update-grub.in index ed8864529..b4bb6058d 100644 --- a/util/update-grub.in +++ b/util/update-grub.in @@ -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 +} + +# 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 :