]> git.donarmstrong.com Git - debhelper.git/blob - dh_installdeb
r1793: releasing version 4.9.12
[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 dh_installdeb is a debhelper program that is responsible for installing
19 files into the DEBIAN directories in package build directories with the
20 correct permissions.
21
22 dh_installdeb automatically installs the following files from debian/ into
23 the DEBIAN directory:
24   package.postinst
25   package.preinst
26   package.postrm
27   package.prerm
28   package.shlibs
29   package.conffiles
30
31 The postinst, preinst, postrm, and prerm are handled specially: If a
32 corresponding file named debian/package.script.debhelper exists, the contents
33 of that file are merged into the script as follows: If the script exists,
34 then anywhere in it that "#DEBHELPER#" appears, the text of the .debhelper
35 file is inserted. If the script does not exist, then a script is generated
36 from the .debhelper file. The .debhelper files are created by other debhelper
37 programs, such as L<dh_installmenu(1)>, and are shell script fragments.
38
39 In V3 compatibility mode and higher, all files in the etc/ directory in a
40 package will automatically be flagged as conffiles by this program, so
41 there is no need to list them manually in package.conffiles.
42
43 =cut
44
45 init();
46
47 foreach my $package (@{$dh{DOPACKAGES}}) {
48         my $tmp=tmpdir($package);
49
50         if (! -d "$tmp/DEBIAN") {
51                 doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
52         }
53
54         if (is_udeb($package)) {
55                 # For udebs, only do the postinst, and no #DEBHELPER#.
56                 my $f=pkgfile($package,"postinst");
57                 if ($f) {
58                         doit("install", "-o", 0, "-g", 0, "-m", 755, 
59                              $f, "$tmp/DEBIAN/postinst");
60                 }
61                 next;           
62         }
63         
64         # Install debian scripts.
65         foreach my $script (qw{postinst preinst prerm postrm}) {
66                 debhelper_script_subst($package, $script);
67         }
68
69         if (! is_udeb($package)) {
70                 # Install non-executable files
71                 foreach my $file (qw{shlibs conffiles}) {
72                         my $f=pkgfile($package,$file);
73                         if ($f) {
74                                 doit("install","-o",0,"-g",0,"-m",644,"-p",$f,"$tmp/DEBIAN/$file");
75                         }
76                 }
77         }
78
79         # Automatic conffiles registration: If it is in /etc, it is a
80         # conffile.
81         if (! compat(2) && -d "$tmp/etc" && ! is_udeb($package)) {
82                 complex_doit("find $tmp/etc -type f -printf '/etc/%P\n' >> $tmp/DEBIAN/conffiles");
83                 # Anything found?
84                 if (-z "$tmp/DEBIAN/conffiles") {
85                         doit("rm", "-f", "$tmp/DEBIAN/conffiles");
86                 }
87                 else {
88                         doit("chmod", 644, "$tmp/DEBIAN/conffiles");
89                 }
90         }
91 }
92
93 =head1 SEE ALSO
94
95 L<debhelper(7)>
96
97 This program is a part of debhelper.
98
99 =head1 AUTHOR
100
101 Joey Hess <joeyh@debian.org>
102
103 =cut