]> git.donarmstrong.com Git - debhelper.git/blob - dh_installdeb
Merge branch 'master' of ssh://git.debian.org/git/debhelper/debhelper
[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 =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 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 DEBIAN directory.
44
45 =item I<package>.conffiles
46
47 This control file will be installed into the DEBIAN directory.
48
49 In V3 compatibility mode and higher, all files in the 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 =back
54
55 =cut
56
57 init();
58
59 foreach my $package (@{$dh{DOPACKAGES}}) {
60         my $tmp=tmpdir($package);
61
62         if (! -d "$tmp/DEBIAN") {
63                 doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
64         }
65
66         if (is_udeb($package)) {
67                 # For udebs, only do the postinst, and no #DEBHELPER#.
68                 # Udebs also support menutest and isinstallable scripts.
69                 foreach my $script (qw{postinst menutest isinstallable}) {
70                         my $f=pkgfile($package,$script);
71                         if ($f) {
72                                 doit("install", "-o", 0, "-g", 0, "-m", 755, 
73                                      $f, "$tmp/DEBIAN/$script");
74                         }
75                 }
76                 next;           
77         }
78         
79         # Install debian scripts.
80         foreach my $script (qw{postinst preinst prerm postrm}) {
81                 debhelper_script_subst($package, $script);
82         }
83
84         if (! is_udeb($package)) {
85                 # Install non-executable files
86                 foreach my $file (qw{shlibs conffiles triggers}) {
87                         my $f=pkgfile($package,$file);
88                         if ($f) {
89                                 doit("install","-o",0,"-g",0,"-m",644,"-p",$f,"$tmp/DEBIAN/$file");
90                         }
91                 }
92         }
93
94         # Automatic conffiles registration: If it is in /etc, it is a
95         # conffile.
96         if (! compat(2) && -d "$tmp/etc" && ! is_udeb($package)) {
97                 complex_doit("find $tmp/etc -type f -printf '/etc/%P\n' >> $tmp/DEBIAN/conffiles");
98                 # Anything found?
99                 if (-z "$tmp/DEBIAN/conffiles") {
100                         doit("rm", "-f", "$tmp/DEBIAN/conffiles");
101                 }
102                 else {
103                         doit("chmod", 644, "$tmp/DEBIAN/conffiles");
104                 }
105         }
106 }
107
108 =head1 SEE ALSO
109
110 L<debhelper(7)>
111
112 This program is a part of debhelper.
113
114 =head1 AUTHOR
115
116 Joey Hess <joeyh@debian.org>
117
118 =cut