5 dh_installinfo - install and register info files
10 use Debian::Debhelper::Dh_Lib;
14 B<dh_installinfo> [S<I<debhelper options>>] [B<-A>] [B<-n>] [S<I<file ...>>]
18 dh_installinfo is a debhelper program that is responsible for installing
19 info files and registering the files it installs with install-info.
21 It determines some information about the info files by parsing them, in
22 particular, it looks at the INFO-DIR-SECTION line to determine what section
23 the info file belongs in.
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.
30 Files named debian/package.info can list other files to be installed.
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.
42 Install all files specified by command line parameters in ALL packages
45 =item B<-n>, B<--noscripts>
47 Do not modify postinst/prerm scripts.
51 Install these info files into the first package acted on. (Or in
52 all packages if -A is specified).
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.
66 foreach my $package (@{$dh{DOPACKAGES}}) {
67 my $tmp=tmpdir($package);
68 my $file=pkgfile($package,"info");
73 @info=filearray($file, ".");
76 if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
81 if ( ! -d "$tmp/usr/share/info") {
82 doit("install","-d","$tmp/usr/share/info");
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/");
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 # Figure out what section this file goes in.
95 open (IN, "<$file") || die "$file: $!";
97 if (/INFO-DIR-SECTION\s+(.*)/) {
104 my $fn="/usr/share/info/".basename($file);
106 if ($section ne '') {
107 $section=~s:/:\\/:g; # allow / in section.
108 $section=~s/\&/\\&/g; # escape sed specials
109 $section=~s/(\\[0-9])/\\\\$1/g; # more sed specials
110 autoscript($package,"postinst","postinst-info",
111 "s/#SECTION#/$section/g;s:#FILE#:$fn:");
114 autoscript($package,"postinst","postinst-info-nosection",
117 autoscript($package,"prerm","prerm-info", "s:#FILE#:$fn:");
126 This program is a part of debhelper.
130 Joey Hess <joeyh@debian.org>