Debian Codegraph @

debian/createmanpages

raw
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 HELPOPTION=--help
24
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 # If program name is different from package name or title should be
35 # different from package short description change this here
36 progname=${PROGNAME}
37 help2man --no-info --no-discard-stderr --help-option="$HELPOPTION" \
38 --name="$NAME" \
39 --version-string="$VERSION" ${progname} > $MANDIR/${progname}.1
40
41 echo "$MANDIR/*.1" > debian/manpages
42
43 cat <<EOT
44 Please enhance the help2man output in '$MANDIR/${progname}.1'.
45 To inspect it, try 'nroff -man $MANDIR/${progname}.1'.
46 If very unhappy, try passing the HELPOPTION as an environment variable.
47 The following web page might be helpful in doing so:
48 http://liw.fi/manpages/
49 EOT
50