summaryrefslogtreecommitdiff
path: root/dh_installmanpages
blob: 9dbf1c9381e68e2f2b1c9d7ec14090f4569b86a0 (plain)
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
#!/bin/sh -e
#
# Automatically find and install man pages.
# This is a little bit DWIMish, but still very handy.

PATH=debian:$PATH:/usr/lib/debhelper
source dh_lib

# Note: this was mostly copied from debstd, and not verified to work.
# Find all filenames that look like man pages.
for file in `find * -name "*.[1-9]*" ! -name "*.ex" ! -name "*.in"`; do
	# Make sure they arn't alreadt in debian/tmp
	if ! expr $file : 'debian/tmp/.*' >/dev/null; then
		# Make sure file thinks they are man pages.
		if file $file|grep -q roff; then
			if echo $file|grep -q /; then
				NAME=`expr $file : '.*/\(.*\)'`
			else
				NAME=$file
			fi
			SECTION=man`expr $NAME : '.*\.\([123456789]\)'`
			if [ ! -e debian/tmp/usr/man/$SECTION/$NAME -a \
			     ! -e debian/tmp/usr/X11*/man/$SECTION/$NAME ]; then
				if [ ! -d debian/tmp/usr/man/$SECTION ]; then
					doit "install -d debian/tmp/usr/man/$SECTION"
				fi
				doit "install -p -m644 $file debian/tmp/usr/man/$SECTION/$NAME"
			fi
		fi
	fi
done