3 # Install files from debian/ into the package's DEBIAN directory.
4 # Also generates the control file.
6 PATH=debian:$PATH:/usr/lib/debhelper
9 for PACKAGE in $DH_DOPACKAGES; do
13 if [ ! -d $TMP/DEBIAN ]; then
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 for file in postinst preinst prerm postrm; do
20 if [ -f debian/$EXT$file ]; then
21 # Add this into the script, where it has #DEBHELPER#
22 if [ -f debian/$EXT$file.debhelper ]; then
23 doit "perl -pe 's~#DEBHELPER#~qx{cat debian/$EXT$file.debhelper}~eg' < debian/$EXT$file > $TMP/DEBIAN/$file"
24 doit "chown root.root $TMP/DEBIAN/$file"
25 doit "chmod 755 $TMP/DEBIAN/$file"
27 doit "install -o root -g root -p debian/$EXT$file $TMP/DEBIAN/$file"
30 # Auto-generate script header and add .debhelper
32 if [ -f debian/$EXT$file.debhelper ]; then
33 doit "echo '#!/bin/sh -e' > $TMP/DEBIAN/$file"
34 doit "cat debian/$EXT$file.debhelper >> $TMP/DEBIAN/$file"
35 doit "chown root.root $TMP/DEBIAN/$file"
36 doit "chmod 755 $TMP/DEBIAN/$file"
41 # Install non-executable files
42 for file in shlibs conffiles; do
43 if [ -f debian/$EXT$file ]; then
44 doit "install -o root -g root -m 644 -p debian/$EXT$file $TMP/DEBIAN/$file"
48 # Run dpkg-shlibdeps to generate dependancies.
50 for file in `find $TMP -type f \( -perm +111 -or -name "*.so*" \) | tr "\n" " "` ; do
51 case "`file $file`" in
53 filelist="$file $filelist"
57 if [ "$filelist" ]; then
58 doit "dpkg-shlibdeps -Tdebian/${EXT}substvars $filelist"
61 # Generate and install control file.
62 doit "dpkg-gencontrol -p$PACKAGE -Tdebian/${EXT}substvars -P$TMP"
63 doit "chown root.root $TMP/DEBIAN/control"