1#!/usr/bin/env bash 2 3export LC_ALL=C 4TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)} 5BUILDDIR=${BUILDDIR:-$TOPDIR} 6 7BINDIR=${BINDIR:-$BUILDDIR/src} 8MANDIR=${MANDIR:-$TOPDIR/doc/man} 9 10BITCOIND=${BITCOIND:-$BINDIR/litecoind} 11BITCOINCLI=${BITCOINCLI:-$BINDIR/litecoin-cli} 12BITCOINTX=${BITCOINTX:-$BINDIR/litecoin-tx} 13WALLET_TOOL=${WALLET_TOOL:-$BINDIR/litecoin-wallet} 14BITCOINQT=${BITCOINQT:-$BINDIR/qt/litecoin-qt} 15 16[ ! -x $BITCOIND ] && echo "$BITCOIND not found or not executable." && exit 1 17 18# The autodetected version git tag can screw up manpage output a little bit 19BTCVER=($($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ print $6, $7 }')) 20 21# Create a footer file with copyright content. 22# This gets autodetected fine for bitcoind if --version-string is not set, 23# but has different outcomes for bitcoin-qt and bitcoin-cli. 24echo "[COPYRIGHT]" > footer.h2m 25$BITCOIND --version | sed -n '1!p' >> footer.h2m 26 27for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $WALLET_TOOL $BITCOINQT; do 28 cmdname="${cmd##*/}" 29 help2man -N --version-string=${BTCVER[0]} --include=footer.h2m -o ${MANDIR}/${cmdname}.1 ${cmd} 30 sed -i "s/\\\-${BTCVER[1]}//g" ${MANDIR}/${cmdname}.1 31done 32 33rm -f footer.h2m 34