]> git.donarmstrong.com Git - debhelper.git/blob - dh_installdeb
r279: * dh_shlibdeps: detect statically linked binaries and don't pass them to
[debhelper.git] / dh_installdeb
1 #!/usr/bin/perl -w
2 #
3 # Install files from debian/ into the package's DEBIAN directory.
4
5 BEGIN { push @INC, "debian", "/usr/share/debhelper" }
6 use Dh_Lib;
7 init();
8
9 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
10         $TMP=tmpdir($PACKAGE);
11         $EXT=pkgext($PACKAGE);
12
13         if (! -d "$TMP/DEBIAN") {
14                 doit("install","-o","root","-g","root","-d","$TMP/DEBIAN");
15         }
16
17         # Install debian install scripts.
18         # If any .debhelper files exist, add them into the scripts.
19         foreach $file (qw{postinst preinst prerm postrm config}) {
20                 $f=pkgfile($PACKAGE,$file);
21                 if ($f) {
22                         if (-f "debian/$EXT$file.debhelper") {
23                                 # Add this into the script, where it has
24                                 # #DEBHELPER#
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");
27                         }
28                         else {
29                                 # Just get rid of any #DEBHELPER# in the 
30                                 # script.
31                                 complex_doit("sed s/#DEBHELPER#// < $f > $TMP/DEBIAN/$file");
32                         }
33                         doit("chown","root.root","$TMP/DEBIAN/$file");
34                         doit("chmod",755,"$TMP/DEBIAN/$file");
35                 }
36                 else {
37                         # Auto-generate script header and add .debhelper
38                         # content to it.
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");
44                         }
45                 }
46         }
47
48         # Install non-executable files
49         foreach $file (qw{shlibs conffiles templates}) {
50                 $f=pkgfile($PACKAGE,$file);
51                 if ($f) {
52                         doit("install","-o","root","-g","root","-m",644,"-p",$f,"$TMP/DEBIAN/$file");
53                 }
54         }
55 }