]> git.donarmstrong.com Git - debhelper.git/blob - dh_installdeb
Typo. Closes: #653339
[debhelper.git] / dh_installdeb
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installdeb - install files into the DEBIAN directory
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_installdeb> [S<I<debhelper options>>]
15
16 =head1 DESCRIPTION
17
18 B<dh_installdeb> is a debhelper program that is responsible for installing
19 files into the F<DEBIAN> directories in package build directories with the
20 correct permissions.
21
22 =head1 FILES
23
24 =over 4
25
26 =item I<package>.postinst
27
28 =item I<package>.preinst
29
30 =item I<package>.postrm
31
32 =item I<package>.prerm
33
34 These maintainer scripts are installed into the F<DEBIAN> directory.
35
36 Inside the scripts, the token B<#DEBHELPER#> is replaced with
37 shell script snippets generated by other debhelper commands.
38
39 =item I<package>.triggers
40
41 =item I<package>.shlibs
42
43 These control files are installed into the F<DEBIAN> directory.
44
45 =item I<package>.conffiles
46
47 This control file will be installed into the F<DEBIAN> directory.
48
49 In v3 compatibility mode and higher, all files in the F<etc/> directory in a
50 package will automatically be flagged as conffiles by this program, so
51 there is no need to list them manually here.
52
53 =item I<package>.maintscript
54
55 Lines in this file correspond to L<dpkg-maintscript-helper(1)> commands and
56 parameters.  Any shell metacharacters will be escaped, so arbitrary shell
57 code cannot be inserted here.  For example, a line such as C<mv_conffile
58 /etc/oldconffile /etc/newconffile> will insert maintainer script snippets
59 into all maintainer scripts sufficient to move that conffile.
60
61 A versioned Pre-Dependency on dpkg is needed to use
62 L<dpkg-maintscript-helper(1)>. An appropriate Pre-Dependency is
63 set in ${misc:Pre-Depends} ; you should make sure to put that token into
64 an appropriate place in your debian/control file.
65
66 =back
67
68 =cut
69
70 init();
71
72 # dpkg-maintscript-helper commands with their associated dpkg pre-dependency
73 # versions.
74 my %maintscript_predeps = (
75         "rm_conffile" => "1.15.7.2",
76         "mv_conffile" => "1.15.7.2",
77 );
78
79 foreach my $package (@{$dh{DOPACKAGES}}) {
80         my $tmp=tmpdir($package);
81
82         if (! -d "$tmp/DEBIAN") {
83                 doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
84         }
85
86         if (is_udeb($package)) {
87                 # For udebs, only do the postinst, and no #DEBHELPER#.
88                 # Udebs also support menutest and isinstallable scripts.
89                 foreach my $script (qw{postinst menutest isinstallable}) {
90                         my $f=pkgfile($package,$script);
91                         if ($f) {
92                                 doit("install", "-o", 0, "-g", 0, "-m", 755, 
93                                      $f, "$tmp/DEBIAN/$script");
94                         }
95                 }
96                 next;           
97         }
98         
99         my $maintscriptfile=pkgfile($package, "maintscript");
100         if ($maintscriptfile) {
101                 foreach my $line (filedoublearray($maintscriptfile)) {
102                         my $cmd=$line->[0];
103                         error("unknown dpkg-maintscript-helper command: $cmd")
104                                 unless exists $maintscript_predeps{$cmd};
105                         addsubstvar($package, "misc:Pre-Depends", "dpkg",
106                                     ">= $maintscript_predeps{$cmd}");
107                         my $params=escape_shell(@$line);
108                         foreach my $script (qw{postinst preinst prerm postrm}) {
109                                 autoscript($package, $script, "maintscript-helper",
110                                            "s!#PARAMS#!$params!g");
111                         }
112                 }
113         }
114
115         # Install debian scripts.
116         foreach my $script (qw{postinst preinst prerm postrm}) {
117                 debhelper_script_subst($package, $script);
118         }
119
120         if (! is_udeb($package)) {
121                 # Install non-executable files
122                 foreach my $file (qw{shlibs conffiles triggers}) {
123                         my $f=pkgfile($package,$file);
124                         if ($f) {
125                                 doit("install","-o",0,"-g",0,"-m",644,"-p",$f,"$tmp/DEBIAN/$file");
126                         }
127                 }
128         }
129
130         # Automatic conffiles registration: If it is in /etc, it is a
131         # conffile.
132         if (! compat(2) && -d "$tmp/etc" && ! is_udeb($package)) {
133                 complex_doit("find $tmp/etc -type f -printf '/etc/%P\n' >> $tmp/DEBIAN/conffiles");
134                 # Anything found?
135                 if (-z "$tmp/DEBIAN/conffiles") {
136                         doit("rm", "-f", "$tmp/DEBIAN/conffiles");
137                 }
138                 else {
139                         doit("chmod", 644, "$tmp/DEBIAN/conffiles");
140                 }
141         }
142 }
143
144 =head1 SEE ALSO
145
146 L<debhelper(7)>
147
148 This program is a part of debhelper.
149
150 =head1 AUTHOR
151
152 Joey Hess <joeyh@debian.org>
153
154 =cut