File: help2man-wrapper

package info (click to toggle)
bowtie2 2.5.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,492 kB
  • sloc: cpp: 63,838; perl: 7,232; sh: 1,131; python: 987; makefile: 541; ansic: 122
file content (23 lines) | stat: -rwxr-xr-x 764 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# Very dirty trick to drain information via help2man even if binary outputs to stderr

if [ $# -ne 2 ] ; then
    echo "Usage: $0 <binary_name> <description>"
    exit 1
fi

pkg=`dpkg-parsechangelog | sed -n 's/^Source: //p'`
version=`dpkg-parsechangelog -ldebian/changelog | grep Version: | cut -f2 -d' ' | cut -f1 -d-`
mandir=${PWD}/debian/${pkg}/usr/share/man/man1/
tmpdir=`mktemp -d`

mkdir -p $tmpdir
binname=$1
tmpbin=${tmpdir}/$binname
echo "#!/bin/sh" > $tmpbin
echo "cat <<END" >> $tmpbin
${PWD}/debian/${pkg}/usr/bin/$binname 2>> $tmpbin
echo "END" >> $tmpbin
chmod 755 $tmpbin
help2man --no-info --help-option="h" --no-discard-stderr --name="$2" --version-string="${version}" $tmpbin | debian/filter.pl > $mandir/${binname}.1
rm -rf $tmpdir