]> git.donarmstrong.com Git - debhelper.git/blob - dh_installdeb
r11: Initial revision
[debhelper.git] / dh_installdeb
1 #!/bin/sh -e
2 #
3 # Install files from debian/ into the package's DEBIAN directory.
4
5 PATH=debian:$PATH:/usr/lib/debhelper
6 . dh_lib
7
8 for PACKAGE in $DH_DOPACKAGES; do
9         TMP=`tmpdir $PACKAGE`
10         EXT=`pkgext $PACKAGE`
11
12         if [ ! -d $TMP/DEBIAN ]; then
13                 doit "install -o root -g root -d $TMP/DEBIAN"
14         fi
15
16         # Install debian install scripts.
17         # If any .debhelper files exist, add them into the scripts.
18         for file in postinst preinst prerm postrm; do
19                 if [ -f debian/$EXT$file ]; then
20                         # Add this into the script, where it has #DEBHELPER#
21                         if [ -f debian/$EXT$file.debhelper ]; then
22                                 complex_doit "perl -pe 's~#DEBHELPER#~qx{cat debian/$EXT$file.debhelper}~eg' < debian/$EXT$file > $TMP/DEBIAN/$file"
23                                 doit "chown root.root $TMP/DEBIAN/$file"
24                                 doit "chmod 755 $TMP/DEBIAN/$file"
25                         else
26                                 doit "install -o root -g root -p debian/$EXT$file $TMP/DEBIAN/$file"
27                         fi
28                 else
29                         # Auto-generate script header and add .debhelper
30                         # content to it.
31                         if [ -f debian/$EXT$file.debhelper ]; then
32                                 complex_doit "echo '#!/bin/sh -e' > $TMP/DEBIAN/$file"
33                                 complex_doit "cat debian/$EXT$file.debhelper >> $TMP/DEBIAN/$file"
34                                 doit "chown root.root $TMP/DEBIAN/$file"
35                                 doit "chmod 755 $TMP/DEBIAN/$file"
36                         fi
37                 fi
38         done
39
40         # Install non-executable files
41         for file in shlibs conffiles; do
42                 if [ -f debian/$EXT$file ]; then
43                         doit "install -o root -g root -m 644 -p debian/$EXT$file $TMP/DEBIAN/$file"
44                 fi                                               
45         done
46 done