#!/bin/sh
MANDIR=debian/man
mkdir -p $MANDIR

VERSION=`dpkg-parsechangelog | awk '/^Version:/ {print $2}' | sed -e 's/^[0-9]*://' -e 's/-.*//' -e 's/[+~]dfsg$//'`
NAME=`grep "^Description:" debian/control | sed 's/^Description: *//' | head -n1`
PROGNAME=`grep "^Package:" debian/control | sed 's/^Package: *//' | head -n1`

# If program name is different from package name or title should be
# different from package short description change this here
progname=riseup-vpn
help2man --no-info --no-discard-stderr --help-option="-h" --locale=C.UTF-8 --section=1 \
         --name="$NAME" \
            --version-string="$VERSION" ${progname} > $MANDIR/${progname}.1


# If program name is different from package name or title should be
# different from package short description change this here
export PATH=$PATH:/usr/sbin
progname=bitmask-root
help2man --no-info --no-discard-stderr --help-option="-h" --locale=C.UTF-8 --section=8 \
         --name="$NAME" \
            --version-string="$VERSION" ${progname} > $MANDIR/${progname}.8
echo $AUTHOR >> $MANDIR/${progname}.8

echo "$MANDIR/*.1" > debian/manpages
echo "$MANDIR/*.8" >> debian/manpages
cat <<EOT
Please enhance the help2man output.
The following web page might be helpful in doing so:
    http://liw.fi/manpages/
EOT

