5 dh_installdeb - install files into the DEBIAN directory
10 use Debian::Debhelper::Dh_Lib;
14 B<dh_installdeb> [S<I<debhelper options>>]
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
26 =item I<package>.postinst
28 =item I<package>.preinst
30 =item I<package>.postrm
32 =item I<package>.prerm
34 These maintainer scripts are installed into the F<DEBIAN> directory.
36 Inside the scripts, the token B<#DEBHELPER#> is replaced with
37 shell script snippets generated by other debhelper commands.
39 =item I<package>.triggers
41 =item I<package>.shlibs
43 These control files are installed into the F<DEBIAN> directory.
45 =item I<package>.conffiles
47 This control file will be installed into the F<DEBIAN> directory.
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.
53 =item I<package>.maintscript
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.
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.
72 # dpkg-maintscript-helper commands with their associated dpkg pre-dependency
74 my %maintscript_predeps = (
75 "rm_conffile" => "1.15.7.2",
76 "mv_conffile" => "1.15.7.2",
79 foreach my $package (@{$dh{DOPACKAGES}}) {
80 my $tmp=tmpdir($package);
82 if (! -d "$tmp/DEBIAN") {
83 doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
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);
92 doit("install", "-o", 0, "-g", 0, "-m", 755,
93 $f, "$tmp/DEBIAN/$script");
99 my $maintscriptfile=pkgfile($package, "maintscript");
100 if ($maintscriptfile) {
101 foreach my $line (filedoublearray($maintscriptfile)) {
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");
115 # Install debian scripts.
116 foreach my $script (qw{postinst preinst prerm postrm}) {
117 debhelper_script_subst($package, $script);
120 if (! is_udeb($package)) {
121 # Install non-executable files
122 foreach my $file (qw{shlibs conffiles triggers}) {
123 my $f=pkgfile($package,$file);
125 doit("install","-o",0,"-g",0,"-m",644,"-p",$f,"$tmp/DEBIAN/$file");
130 # Automatic conffiles registration: If it is in /etc, it is a
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");
135 if (-z "$tmp/DEBIAN/conffiles") {
136 doit("rm", "-f", "$tmp/DEBIAN/conffiles");
139 doit("chmod", 644, "$tmp/DEBIAN/conffiles");
148 This program is a part of debhelper.
152 Joey Hess <joeyh@debian.org>