summaryrefslogtreecommitdiff
path: root/dh_undocumented
blob: edd873f79d6647a6822cd0fdd0a3c2e8a11c9087 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh -e
#
# Passed a list of undocumented man pages, generates symlinks to
# undocumented.7.gz for those man pages.
#
# Also, it looks for debian/undocumented files for more lists of
# undocumented man pages.

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

for PACKAGE in $DH_DOPACKAGES; do
        TMP=`tmpdir $PACKAGE`
	undocumented=`pkgfile $PACKAGE undocumented`

	undoc=""

	if [ "$undocumented" ]; then
		undoc=`tr "\n" " " < $undocumented`
	fi

	if [ \( "$PACKAGE" = "$DH_FIRSTPACKAGE" -o "$DH_PARAMS_ALL" \) \
	     -a "$*" ]; then
		undoc="$* $undoc"
	fi

	if [ "$undoc" ]; then
		for file in $undoc; do
			# Remove .gz extention from the filename, if present.
			if [ `expr "$file" : '\(.*\).gz'` ]; then
				file=`expr "$file" : '\(.*\).gz'`
			fi

			# Determine what directory the file belongs in,
			# /usr/man, or /usr/X11R6/man.
			section=`expr "$file" : '.*\.\([123456789]\)'` \
				|| error "\"$file\" does not have an extention."
			if [ `expr "$file" : '.*\.[123456789]\(x\)'` ] ; then
				dir=usr/X11R6/man/man$section
				reldir=../../../man
			else
				dir=usr/man/man$section
				reldir=..
			fi

			if [ ! -d $TMP/$dir ]; then
				doit "install -d $TMP/$dir"
			fi

			doit "ln -s $reldir/man7/undocumented.7.gz $TMP/$dir/$file.gz"
		done
	fi
done