5 dh_installdeb - install files into the DEBIAN directory
10 use Debian::Debhelper::Dh_Lib;
14 B<dh_installdeb> [S<I<debhelper options>>]
18 dh_installdeb is a debhelper program that is responsible for installing
19 files into the DEBIAN directories in package build directories with the
22 dh_installdeb automatically installs the following files from debian/ into
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.
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.
47 foreach my $package (@{$dh{DOPACKAGES}}) {
48 my $tmp=tmpdir($package);
49 my $ext=pkgext($package);
51 if (! -d "$tmp/DEBIAN") {
52 doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
55 if (is_udeb($package)) {
56 # For udebs, only do the postinst, and no #DEBHELPER#.
57 my $f=pkgfile($package,"postinst");
59 doit("install", "-o", 0, "-g", 0, "-m", 755,
60 $f, "$tmp/DEBIAN/postinst");
65 # Install debian install scripts.
66 # If any .debhelper files exist, add them into the scripts.
67 foreach my $file (qw{postinst preinst prerm postrm}) {
68 my $f=pkgfile($package,$file);
70 if (-f "debian/$ext$file.debhelper") {
71 # Add this into the script, where it has
73 complex_doit("perl -pe 's~#DEBHELPER#~qx{cat debian/$ext$file.debhelper}~eg' < $f > $tmp/DEBIAN/$file");
76 # Just get rid of any #DEBHELPER# in the
78 complex_doit("sed s/#DEBHELPER#// < $f > $tmp/DEBIAN/$file");
80 doit("chown","0:0","$tmp/DEBIAN/$file");
81 doit("chmod",755,"$tmp/DEBIAN/$file");
84 # Auto-generate script header and add .debhelper
86 if (-f "debian/$ext$file.debhelper") {
87 complex_doit("printf '#!/bin/sh\nset -e\n' > $tmp/DEBIAN/$file");
88 complex_doit("cat debian/$ext$file.debhelper >> $tmp/DEBIAN/$file");
89 doit("chown","0:0","$tmp/DEBIAN/$file");
90 doit("chmod",755,"$tmp/DEBIAN/$file");
95 # Install non-executable files
96 foreach my $file (qw{shlibs conffiles}) {
97 my $f=pkgfile($package,$file);
99 doit("install","-o",0,"-g",0,"-m",644,"-p",$f,"$tmp/DEBIAN/$file");
103 # Automatic conffiles registration: If it is in /etc, it is a
105 if (! compat(2) && -d "$tmp/etc") {
106 complex_doit("find $tmp/etc -type f -printf '/etc/%P\n' >> $tmp/DEBIAN/conffiles");
108 if (-z "$tmp/DEBIAN/conffiles") {
109 doit("rm", "-f", "$tmp/DEBIAN/conffiles");
112 doit("chmod", 644, "$tmp/DEBIAN/conffiles");
121 This program is a part of debhelper.
125 Joey Hess <joeyh@debian.org>