3 # Automatically find and install man pages. However, do not install any man
4 # pages listed on the command line.
5 # Also change man pages with .so commands in them into symlinks.
7 # This is a little bit (hah!) DWIMish, but still very handy.
9 PATH=debian:$PATH:/usr/lib/debhelper
12 for PACKAGE in $DH_DOPACKAGES; do
15 # Find all filenames that look like man pages.
16 # .ex files are examples installed by deb-make, we don't want those, or
17 # .in files, which are from configure.
18 # We also need to exclude all debian/tmp type dirs.
19 EXCLUDE=`grep ^Package: debian/control | \
20 cut -d " " -f 2 | tr "\n" "|"`
21 for file in `find * -type f -name "*.[1-9]*" ! -name "*.ex" \
22 ! -name "*.in" | egrep -v "^debian/(${EXCLUDE}tmp)/"`
24 # Make sure file thinks they are man pages.
25 if file -L $file|grep -q roff; then
26 if echo $file|grep -q /; then
27 NAME=`expr $file : '.*/\(.*\)'`
31 # Look at the command line and check if we should
34 for notinstall in $@; do
35 if [ "$NAME" = "$notinstall" -o \
36 "$file" = "$notinstall" ]; then
40 if [ "$install" ]; then
41 SECTION=man`expr $NAME : '.*\.\([123456789]\)'`
42 # Test to see if the filename ends with 'x',
43 # if so, this is an X man page.
44 if expr $NAME : '.*\.[123456789]x' >/dev/null; then
49 if [ ! -e $TMP/usr/man/$SECTION/$NAME -a \
50 ! -e $TMP/usr/X11*/man/$SECTION/$NAME ]; then
51 if [ ! -d $TMP/usr/$EXTDIR/man/$SECTION ]; then
52 doit "install -d $TMP/usr/$EXTDIR/man/$SECTION"
54 doit "install -p -m644 $file $TMP/usr/$EXTDIR/man/$SECTION/$NAME"
60 # Now the .so conversion.
61 for file in `find $TMP/usr/man $TMP/usr/X11*/man -type f -size -256c 2>/dev/null`
63 solink=`expr "\`head -1 $file\`" : '\.so \(.*\)'`
64 if [ "$solink" ]; then
66 # The .so links include the subdir the page is in,
68 doit "ln -s ../$solink $file"