2018-06-20 11:54:54 +02:00
|
|
|
#!/usr/bin/env bash
|
2016-08-27 00:59:07 +02:00
|
|
|
|
2018-06-13 16:50:48 +02:00
|
|
|
export LC_ALL=C
|
2016-09-01 16:51:24 +02:00
|
|
|
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
|
2018-01-31 11:22:42 +01:00
|
|
|
BUILDDIR=${BUILDDIR:-$TOPDIR}
|
|
|
|
|
|
|
|
BINDIR=${BINDIR:-$BUILDDIR/src}
|
2016-09-01 16:51:24 +02:00
|
|
|
MANDIR=${MANDIR:-$TOPDIR/doc/man}
|
|
|
|
|
2018-01-31 11:22:42 +01:00
|
|
|
BITCOIND=${BITCOIND:-$BINDIR/bitcoind}
|
|
|
|
BITCOINCLI=${BITCOINCLI:-$BINDIR/bitcoin-cli}
|
|
|
|
BITCOINTX=${BITCOINTX:-$BINDIR/bitcoin-tx}
|
2019-02-06 16:04:45 +01:00
|
|
|
WALLET_TOOL=${WALLET_TOOL:-$BINDIR/bitcoin-wallet}
|
2018-01-31 11:22:42 +01:00
|
|
|
BITCOINQT=${BITCOINQT:-$BINDIR/qt/bitcoin-qt}
|
2016-09-01 16:51:24 +02:00
|
|
|
|
|
|
|
[ ! -x $BITCOIND ] && echo "$BITCOIND not found or not executable." && exit 1
|
|
|
|
|
|
|
|
# The autodetected version git tag can screw up manpage output a little bit
|
2019-07-02 18:48:08 +02:00
|
|
|
read -r -a BTCVER <<< "$($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ print $6, $7 }')"
|
2016-08-27 00:59:07 +02:00
|
|
|
|
|
|
|
# Create a footer file with copyright content.
|
2016-09-01 16:51:24 +02:00
|
|
|
# This gets autodetected fine for bitcoind if --version-string is not set,
|
|
|
|
# but has different outcomes for bitcoin-qt and bitcoin-cli.
|
2016-08-27 00:59:07 +02:00
|
|
|
echo "[COPYRIGHT]" > footer.h2m
|
2016-09-01 16:51:24 +02:00
|
|
|
$BITCOIND --version | sed -n '1!p' >> footer.h2m
|
2016-08-27 00:59:07 +02:00
|
|
|
|
2019-02-06 16:04:45 +01:00
|
|
|
for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $WALLET_TOOL $BITCOINQT; do
|
2016-09-01 16:51:24 +02:00
|
|
|
cmdname="${cmd##*/}"
|
|
|
|
help2man -N --version-string=${BTCVER[0]} --include=footer.h2m -o ${MANDIR}/${cmdname}.1 ${cmd}
|
|
|
|
sed -i "s/\\\-${BTCVER[1]}//g" ${MANDIR}/${cmdname}.1
|
2016-08-27 00:59:07 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
rm -f footer.h2m
|