]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_installmanpages
r95: Initial Import
[debhelper.git] / dh_installmanpages
index 9bcd891015a5e311aa986151ce231f433290c7da..a8fb1e992dfda7eaa80f81644540e690efb5601b 100755 (executable)
@@ -2,7 +2,9 @@
 #
 # Automatically find and install man pages. However, do not install any man 
 # pages listed on the command line.
-# This is a little bit DWIMish, but still very handy.
+# Also change man pages with .so commands in them into symlinks.
+#
+# This is a little bit (hah!) DWIMish, but still very handy.
 
 PATH=debian:$PATH:/usr/lib/debhelper
 . dh_lib
@@ -14,10 +16,13 @@ for PACKAGE in $DH_DOPACKAGES; do
        # .ex files are examples installed by deb-make, we don't want those, or
        # .in files, which are from configure.
        # We also need to exclude all debian/tmp type dirs.
-       EXCLUDE=`grep ^Package: debian/control | cut -d " " -f 2 | tac | tr "\n" "|"`
-       for file in `find * -name "*.[1-9]*" ! -name "*.ex" ! -name "*.in" | egrep -v "^debian/(${EXCLUDE}tmp)"`; do
+       EXCLUDE=`grep ^Package: debian/control | \
+               cut -d " " -f 2 | tr "\n" "|"`
+       for file in `find * -type f -name "*.[1-9]*" ! -name "*.ex" \
+               ! -name "*.in" | egrep -v "^debian/(${EXCLUDE}tmp)/"`
+       do
                # Make sure file thinks they are man pages.
-               if file $file|grep -q roff; then
+               if file -L $file|grep -q roff; then
                        if echo $file|grep -q /; then
                                NAME=`expr $file : '.*/\(.*\)'`
                        else
@@ -34,14 +39,33 @@ for PACKAGE in $DH_DOPACKAGES; do
                        done
                        if [ "$install" ]; then
                                SECTION=man`expr $NAME : '.*\.\([123456789]\)'`
+                               # Test to see if the filename ends with 'x',
+                               # if so, this is an X man page.
+                               if expr $NAME : '.*\.[123456789]x' >/dev/null; then
+                                       EXTDIR="X11R6"
+                               else
+                                       EXTDIR=""
+                               fi
                                if [ ! -e $TMP/usr/man/$SECTION/$NAME -a \
                                     ! -e $TMP/usr/X11*/man/$SECTION/$NAME ]; then
-                                       if [ ! -d $TMP/usr/man/$SECTION ]; then
-                                               doit "install -d $TMP/usr/man/$SECTION"
+                                       if [ ! -d $TMP/usr/$EXTDIR/man/$SECTION ]; then
+                                               doit "install -d $TMP/usr/$EXTDIR/man/$SECTION"
                                        fi
-                                       doit "install -p -m644 $file $TMP/usr/man/$SECTION/$NAME"
+                                       doit "install -p -m644 $file $TMP/usr/$EXTDIR/man/$SECTION/$NAME"
                                fi
                        fi
                fi
        done
+
+       # Now the .so conversion.
+       for file in `find $TMP/usr/man $TMP/usr/X11*/man -type f -size -256c 2>/dev/null`
+       do
+               solink=`expr "\`head -1 $file\`" : '\.so \(.*\)'`
+               if [ "$solink" ]; then
+                       doit "rm -f $file"
+                       # The .so links include the subdir the page is in, 
+                       # thus the ../
+                       doit "ln -s ../$solink $file"
+               fi
+       done
 done