]> git.donarmstrong.com Git - debhelper.git/blob - dh_undocumented
r266: * FHS complience. Patch from Johnie Ingram <johnie@netgod.net>.
[debhelper.git] / dh_undocumented
1 #!/usr/bin/perl -w
2 #
3 # Passed a list of undocumented man pages, generates symlinks to
4 # undocumented.7.gz for those man pages.
5 #
6 # Also, it looks for debian/undocumented files for more lists of
7 # undocumented man pages.
8
9 BEGIN { push @INC, "debian", "/usr/share/debhelper" }
10 use Dh_Lib;
11 init();
12
13 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
14         $TMP=tmpdir($PACKAGE);
15         $undocumented=pkgfile($PACKAGE,"undocumented");
16
17         @undoc=();
18         if ($undocumented) {
19                 @undoc=filearray($undocumented);
20         }
21
22         if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
23                 push @undoc, @ARGV;
24         }       
25
26         foreach $file (@undoc) {
27                 $file=~s/.gz$//; # .gz extention is optional in input.
28
29                 # Determine what directory the file belongs in,
30                 # /usr/share/man, or /usr/X11R6/man, and how the link to
31                 # the undocuemtned.7 man page will look.
32                 ($section)=$file=~m/^.*\.(\d)/;
33                 if (!$section) {
34                         error("\"$file\" does not have an extention.");
35                 }       
36                 if ($file=~/.*\.\dx/) {
37                         $dir="usr/X11R6/man/man$section";
38                         $reldir="../../../man/man7/";
39                 }
40                 elsif ($section != 7) {
41                         $dir="usr/share/man/man$section";
42                         $reldir="../man7/";
43                 }
44                 else {
45                         $dir="usr/share/man/man$section";
46                         $reldir="";
47                 }
48
49                 if (! -d "$TMP/$dir") {
50                         doit("install","-d","$TMP/$dir");
51                 }
52                 doit("ln","-sf","${reldir}undocumented.7.gz","$TMP/$dir/$file.gz");
53         }
54 }