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