- for file in postinst preinst prerm postrm; do
- if [ -f debian/$EXT$file ]; then
- # Add this into the script, where it has #DEBHELPER#
- if [ -f debian/$EXT$file.debhelper ]; then
- complex_doit "perl -pe 's~#DEBHELPER#~qx{cat debian/$EXT$file.debhelper}~eg' < debian/$EXT$file > $TMP/DEBIAN/$file"
- doit "chown root.root $TMP/DEBIAN/$file"
- doit "chmod 755 $TMP/DEBIAN/$file"
- else
- doit "install -o root -g root -p debian/$EXT$file $TMP/DEBIAN/$file"
- fi
- else
+ foreach $file (qw{postinst preinst prerm postrm config}) {
+ $f=pkgfile($PACKAGE,$file);
+ if ($f) {
+ if (-f "debian/$EXT$file.debhelper") {
+ # Add this into the script, where it has
+ # #DEBHELPER#
+ # TODO: do internally, no perl fork?
+ complex_doit("perl -pe 's~#DEBHELPER#~qx{cat debian/$EXT$file.debhelper}~eg' < $f > $TMP/DEBIAN/$file");
+ }
+ else {
+ # Just get rid of any #DEBHELPER# in the
+ # script.
+ complex_doit("sed s/#DEBHELPER#// < $f > $TMP/DEBIAN/$file");
+ }
+ doit("chown","root.root","$TMP/DEBIAN/$file");
+ doit("chmod",755,"$TMP/DEBIAN/$file");
+ }
+ else {