#!/bin/bash
# Generate manual page based on the --help output.
#
# This is intended to be run _manually_ from the package root directory
# (that place where the *.spec file is placed).
die() {
echo >&2 "fail: $@"
exit 1
}
MANPAGE=pg_filedump.1
BIN=`find -name pg_filedump`
export BIN
if test -z "$BIN"; then
die "no binary compiled?"
fi
DESCRIPTION="Display formatted contents of a PostgreSQL heap/index/control file"
$BIN -h | grep "$DESCRIPTION" &>/dev/null
if test $? -ne 0; then
die "changed description"
fi
help2man -N \
--include=genMan/pg_filedump.h2m \
genMan/helpWrap > $MANPAGE
COUNT=`git diff $MANPAGE | wc -l`
if test "$COUNT" != "0"; then
echo "Manual page needs to be committed!"
fi