]> git.donarmstrong.com Git - debhelper.git/blob - dh_undocumented
r11: Initial revision
[debhelper.git] / dh_undocumented
1 #!/bin/sh -e
2 #
3 # Passed a list of undocumented man pages, generates symlinks to
4 # undocumented.7 for those man pages.
5 #
6 # Also, it looks for debian/undocumented files for more lists of
7 # undocumented man pages.
8
9 PATH=debian:$PATH:/usr/lib/debhelper
10 . dh_lib
11
12 for PACKAGE in $DH_DOPACKAGES; do
13         TMP=`tmpdir $PACKAGE`
14         EXT=`pkgext $PACKAGE`
15
16         undoc=""
17
18         if [ -e debian/${EXT}undocumented ]; then
19                 undoc=`tr "\n" " " < debian/${EXT}undocumented`
20         fi
21
22         if [ "$PACKAGE" = "$MAINPACKAGE" -a "$*" ]; then
23                 undoc="$* $undoc"
24         fi
25
26         if [ "$undoc" ]; then
27                 for file in $undoc; do
28                         # Remove .gz extention from the filename, if present.
29                         if [ `expr "$file" : '\(.*\).gz'` ]; then
30                                 file=`expr "$file" : '\(.*\).gz'`
31                         fi
32
33                         # Determine what directory the file belongs in,
34                         # /usr/man, or /usr/X11R6/man.
35                         section=`expr "$file" : '.*\.\([123456789]\)'`
36                         if [ `expr "$file" : '.*\.[123456789]\(x\)'` ] ; then
37                                 dir=usr/X11R6/man/man$section
38                                 reldir=../../../man
39                         else
40                                 dir=usr/man/man$section
41                                 reldir=..
42                         fi
43
44                         if [ ! -d debian/$TMP/$dir ]; then
45                                 doit "install -d debian/$TMP/$dir"
46                         fi
47
48                         doit ln -s $reldir/man7/undocumented.7.gz debian/$TMP/$dir/$file.gz
49                 done
50         fi
51 done