| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
if [ ! -x /usr/bin/help2man ]; then |
| 6 |
echo "E: Missing /usr/bin/help2man, please install it from the cognate package." |
| 7 |
exit 1 |
| 8 |
fi |
| 9 |
|
| 10 |
if [ ! -n "$NAME" ]; then |
| 11 |
NAME=`grep "^Description:" debian/control | sed 's/^Description: *//' | head -n1` |
| 12 |
fi |
| 13 |
|
| 14 |
if [ ! -n "$VERSION" ]; then |
| 15 |
VERSION=`dpkg-parsechangelog | awk '/^Version:/ {print $2}' | sed -e 's/^[0-9]*://' -e 's/-.*//' -e 's/[+~]dfsg$//'` |
| 16 |
fi |
| 17 |
|
| 18 |
if [ ! -n "$PROGNAME" ]; then |
| 19 |
PROGNAME=`grep "^Package:" debian/control | sed 's/^Package: *//' | head -n1` |
| 20 |
fi |
| 21 |
|
| 22 |
MANDIR=debian |
| 23 |
|
| 24 |
HELPOPTION="--help" |
| 25 |
echo "PROGNAME: '$PROGNAME'" |
| 26 |
echo "NAME: '$NAME'" |
| 27 |
echo "VERSION: '$VERSION'" |
| 28 |
echo "MANDIR: '$MANDIR'" |
| 29 |
echo "HELPOPTION: '$HELPOPTION'" |
| 30 |
|
| 31 |
mkdir -p $MANDIR |
| 32 |
|
| 33 |
|
| 34 |
AUTHOR=".SH AUTHOR\n \ |
| 35 |
This manpage was written by $DEBFULLNAME for the Debian distribution and\n \ |
| 36 |
can be used for any other usage of the program.\ |
| 37 |
" |
| 38 |
|
| 39 |
# If program name is different from package name or title should be |
| 40 |
# different from package short description change this here |
| 41 |
progname=${PROGNAME} |
| 42 |
help2man --no-info --no-discard-stderr --help-option="$HELPOPTION" \ |
| 43 |
--name="$NAME" \ |
| 44 |
--version-string="$VERSION" ${progname} > $MANDIR/${progname}.1 |
| 45 |
echo $AUTHOR >> $MANDIR/${progname}.1 |
| 46 |
|
| 47 |
echo "$MANDIR/*.1" > debian/manpages |
| 48 |
|
| 49 |
cat <<EOT |
| 50 |
Please enhance the help2man output in '$MANDIR/${progname}.1'. |
| 51 |
To inspect it, try 'nroff -man $MANDIR/${progname}.1'. |
| 52 |
If very unhappy, try passing the HELPOPTION as an environment variable. |
| 53 |
The following web page might be helpful in doing so: |
| 54 |
http://liw.fi/manpages/ |
| 55 |
EOT |