/usr/bin/debman is in debian-goodies 0.69.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | #! /bin/bash -e
# debman - read a man page from an uninstalled Debian package file (.deb)
# Copyright (C) 2003 Colin Watson <cjwatson@debian.org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
usage () {
if [ "$1" -eq 1 ]; then
FD=2
else
FD=1
fi
cat >&$FD <<EOF
Usage: debman [options] [-- man(1) options] <man page name> ...
Options should be exactly one of:
-f package.deb read pages from package.deb archive
-p package download .deb for package and read pages
from there
EOF
exit "$1"
}
ARGS=`getopt -l help,filename:,package: -o hf:p: -n debman -- "$@"`
eval set -- "$ARGS"
FILENAME=
PACKAGE=
while :; do
case "$1" in
-h|--help)
usage 0
;;
-f|--filename)
FILENAME="$2"
shift 2
;;
-p|--package)
PACKAGE="$2"
shift 2
;;
--)
shift
break
;;
*)
echo "debman: Internal error in option parsing" >&2
exit 1
;;
esac
done
if ( [ -n "$FILENAME" ] && [ -n "$PACKAGE" ] ) || \
( [ -z "$FILENAME" ] && [ -z "$PACKAGE" ] ); then
usage 1
fi
if test $# -lt 1; then
usage 1
fi
# Directory names are duplicated with and without ./ in order to cope with
# old .debs whose data.tar.gz components had a slightly different format.
MANDIRS='usr/share/man usr/X11R6/man ./usr/share/man ./usr/X11R6/man'
TEMPDIR=`mktemp -dt debman.XXXXXXXXXX`
trap 'rm -rf "$TEMPDIR"' EXIT ERR HUP INT QUIT TERM
if [ -n "$PACKAGE" ]; then
(cd "$TEMPDIR" && debget "$PACKAGE")
# There should be at most one file in $TEMPDIR now.
FILENAME="`find \"$TEMPDIR\" -name \*.deb -print`"
if [ -z "$FILENAME" ]; then
echo "Failed to fetch package $PACKAGE; exiting." >&2
exit 1
fi
fi
# Ignore errors from tar (though not dpkg). They'll generally just be of the
# form "tar: usr/share/man: Not found in archive". If they're something
# else, then man will fail to find the page anyway.
dpkg --fsys-tarfile "$FILENAME" | \
(tar -C "$TEMPDIR" -xf - $MANDIRS 2>/dev/null || true)
MANPATH="$TEMPDIR/usr/share/man:$TEMPDIR/usr/X11R6/man" man "$@"
# vi: expandtab
|