3 # Install files from debian/ into the package's DEBIAN directory.
5 BEGIN { push @INC, "debian", "/usr/share/debhelper" }
9 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
10 $TMP=tmpdir($PACKAGE);
11 $EXT=pkgext($PACKAGE);
13 if (! -d "$TMP/DEBIAN") {
14 doit("install","-o","root","-g","root","-d","$TMP/DEBIAN");
17 # Install debian install scripts.
18 # If any .debhelper files exist, add them into the scripts.
19 foreach $file (qw{postinst preinst prerm postrm}) {
20 $f=pkgfile($PACKAGE,$file);
22 if (-f "debian/$EXT$file.debhelper") {
23 # Add this into the script, where it has
25 # TODO: do internally, no perl fork?
26 complex_doit("perl -pe 's~#DEBHELPER#~qx{cat debian/$EXT$file.debhelper}~eg' < $f > $TMP/DEBIAN/$file");
29 # Just get rid of any #DEBHELPER# in the
31 complex_doit("sed s/#DEBHELPER#// < $f > $TMP/DEBIAN/$file");
33 doit("chown","root.root","$TMP/DEBIAN/$file");
34 doit("chmod",755,"$TMP/DEBIAN/$file");
37 # Auto-generate script header and add .debhelper
39 if (-f "debian/$EXT$file.debhelper") {
40 complex_doit("echo '#!/bin/sh -e' > $TMP/DEBIAN/$file");
41 complex_doit("cat debian/$EXT$file.debhelper >> $TMP/DEBIAN/$file");
42 doit("chown","root.root","$TMP/DEBIAN/$file");
43 doit("chmod",755,"$TMP/DEBIAN/$file");
48 # Install non-executable files
49 foreach $file (qw{shlibs conffiles}) {
50 $f=pkgfile($PACKAGE,$file);
52 doit("install","-o","root","-g","root","-m",644,"-p",$f,"$TMP/DEBIAN/$file");