]> git.donarmstrong.com Git - debhelper.git/blob - dh_installinfo
r1956: * Correct some incorrect instances of "v4 only" in docs. Closes: #381536
[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 . See L<dh_installdeb(1)> for an
34 explanation of how this works.
35
36 =head1 OPTIONS
37
38 =over 4
39
40 =item B<-A>, B<--all>
41
42 Install all files specified by command line parameters in ALL packages
43 acted on.
44
45 =item B<-n>, B<--noscripts>
46
47 Do not modify postinst/prerm scripts.
48
49 =item I<file ...>
50
51 Install these info files into the first package acted on. (Or in
52 all packages if -A is specified).
53
54 =back
55
56 =head1 NOTES
57
58 Note that this command is not idempotent. "dh_clean -k" should be called
59 between invocations of this command. Otherwise, it may cause multiple
60 instances of the same text to be added to maintainer scripts.
61
62 =cut
63
64 init();
65
66 foreach my $package (@{$dh{DOPACKAGES}}) {
67         my $tmp=tmpdir($package);
68         my $file=pkgfile($package,"info");
69
70         my @info;
71         
72         if ($file) {
73                 @info=filearray($file, ".");
74         }
75
76         if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
77                 push @info, @ARGV;
78         }
79
80         if (@info) {
81                 if ( ! -d "$tmp/usr/share/info") {
82                         doit("install","-d","$tmp/usr/share/info");
83                 }
84                 doit("cp",@info,"$tmp/usr/share/info");
85                 doit("chmod","-R", "go=rX","$tmp/usr/share/info/");
86                 doit("chmod","-R", "u+rw","$tmp/usr/share/info/");
87         }
88
89         foreach $file (@info) {
90                 # Only register with install-info if this is a head file in
91                 # a tree of info files.
92                 if ($file !~ /-\d+$/ && ! $dh{NOSCRIPTS}) {
93                         my $fn="/usr/share/info/".basename($file);
94                         
95                         autoscript($package,"postinst","postinst-info",
96                                 "s:#FILE#:$fn:");
97                         autoscript($package,"prerm","prerm-info", "s:#FILE#:$fn:");
98                 }
99         }
100 }
101
102 =head1 SEE ALSO
103
104 L<debhelper(7)>
105
106 This program is a part of debhelper.
107
108 =head1 AUTHOR
109
110 Joey Hess <joeyh@debian.org>
111
112 =cut