]> git.donarmstrong.com Git - debhelper.git/blob - dh_installinfo
r1968: * dh_fixperms: Make all files in /usr/include 644, not only .h files.
[debhelper.git] / dh_installinfo
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installinfo - install and register info files
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_installinfo> [S<I<debhelper options>>] [B<-A>] [B<-n>] [S<I<file ...>>]
15
16 =head1 DESCRIPTION
17
18 dh_installinfo is a debhelper program that is responsible for installing
19 info files and registering the files it installs with install-info.
20
21 Note that install-info determines some information about the info files by
22 parsing them, in particular, it looks at the INFO-DIR-SECTION line to
23 determine what section the info file belongs in.
24
25 Any filenames specified as parameters will be installed into the first
26 package dh_installinfo is told to act on. By default, this is the first
27 binary package in debian/control, but if you use -p, -i, or -a flags, it
28 will be the first package specified by those flags.
29
30 Files named debian/package.info can list other files to be installed.
31
32 dh_installinfo will automatically generate the postinst and prerm commands
33 needed to interface with install-info, updating the info dir. These
34 commands are inserted into the maintainer scripts by dh_installdeb.
35 See L<dh_installdeb(1)> for an explanation of how this works.
36
37 =head1 OPTIONS
38
39 =over 4
40
41 =item B<-A>, B<--all>
42
43 Install all files specified by command line parameters in ALL packages
44 acted on.
45
46 =item B<-n>, B<--noscripts>
47
48 Do not modify postinst/prerm scripts.
49
50 =item I<file ...>
51
52 Install these info files into the first package acted on. (Or in
53 all packages if -A is specified).
54
55 =back
56
57 =head1 NOTES
58
59 Note that this command is not idempotent. "dh_clean -k" should be called
60 between invocations of this command. Otherwise, it may cause multiple
61 instances of the same text to be added to maintainer scripts.
62
63 =cut
64
65 init();
66
67 foreach my $package (@{$dh{DOPACKAGES}}) {
68         my $tmp=tmpdir($package);
69         my $file=pkgfile($package,"info");
70
71         my @info;
72         
73         if ($file) {
74                 @info=filearray($file, ".");
75         }
76
77         if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
78                 push @info, @ARGV;
79         }
80
81         if (@info) {
82                 if ( ! -d "$tmp/usr/share/info") {
83                         doit("install","-d","$tmp/usr/share/info");
84                 }
85                 doit("cp",@info,"$tmp/usr/share/info");
86                 doit("chmod","-R", "go=rX","$tmp/usr/share/info/");
87                 doit("chmod","-R", "u+rw","$tmp/usr/share/info/");
88         }
89
90         foreach $file (@info) {
91                 # Only register with install-info if this is a head file in
92                 # a tree of info files.
93                 if ($file !~ /-\d+$/ && ! $dh{NOSCRIPTS}) {
94                         my $fn="/usr/share/info/".basename($file);
95                         
96                         autoscript($package,"postinst","postinst-info",
97                                 "s:#FILE#:$fn:");
98                         autoscript($package,"prerm","prerm-info", "s:#FILE#:$fn:");
99                 }
100         }
101 }
102
103 =head1 SEE ALSO
104
105 L<debhelper(7)>
106
107 This program is a part of debhelper.
108
109 =head1 AUTHOR
110
111 Joey Hess <joeyh@debian.org>
112
113 =cut