--- a/debian/littlebird-tc-core.postinst Sat Sep 03 00:03:24 2011 +0200
+++ b/debian/littlebird-tc-core.postinst Mon Sep 05 12:20:54 2011 +0200
@@ -29,6 +29,7 @@
chmod -R g+w "$DIR"
# Timezone in /usr/local/zend/etc/php.ini
+ # note: this file is handled as a conffile under ucf control
f=/usr/local/zend/etc/php.ini
perl -pi -e 's{^;?\s*(date\.timezone\s*=).*$}{$1 "Europe/Berlin"}' $f
@@ -95,13 +96,19 @@
fi
fi
+ # wozu brauchen wir das? hs - 9/2011
+ test "$crt" && ucfr littlebird-tc-core "$crt"
+ test "$key" && ucfr littlebird-tc-core "$key"
+
# tweak the config file, but just the lines following a magical
# debconf line
- perl - serveradmin="$serveradmin" servername="$servername" serverport="$serverport" \
+ cp /usr/share/doc/littlebird-tc/examples/apache/littlebird-tc $tmp
+ perl - "$tmp" serveradmin="$serveradmin" servername="$servername" serverport="$serverport" \
crt="$crt" key="$key" <<'_'
use strict;
use warnings;
my $mark = '# debconf:';
+ my $tmpfile = shift;
my %o;
foreach (@ARGV) { my ($k, $v) = split /=/, $_, 2; $o{$k} = $v }
if ($o{serverport} eq "443") {
@@ -114,7 +121,7 @@
}
- open(F, "+</etc/apache2/conf.d/littlebird-tc") or die;
+ open(F, "+<$tmpfile") or die;
$_ = join "" => <F>;
s|^(([ \t]*?)# debconf: (.*?){{(.*?)}}(.*?)\n).*?\n|$1$2$3$o{$4}$5\n|migs;
seek(F, 0, 0);
@@ -123,6 +130,8 @@
close(F);
_
+ ucf --debconf-ok $tmp /etc/apache2/conf.d/littlebird-tc
+
# need log dir(s)
( . /etc/apache2/envvars
file=`perl -ne '/^\s*errorlog\s+(\S+)/i&&print "$1\n"' /etc/apache2/conf.d/littlebird-tc`
@@ -134,6 +143,7 @@
)
# fix application_ini, there should be a cleaner approach
+ # for now we do not consider this as a config file!
db_get littlebird-tc/db/name && dbname="$RET" || true
db_get littlebird-tc/db/host && dbhost="$RET" || true
@@ -168,11 +178,12 @@
db_stop || true
( . /etc/apache2/envvars
+ invoke=`which invoke-rc.d`
if ! apache2 -M 2>/dev/null | grep -q ssl_module; then
a2enmod ssl
- invoke-rc.d apache2 restart >&2
+ test "$invoke" && $invoke apache2 restart >&2
else
- invoke-rc.d apache2 reload >&2
+ test "$invoke" && $invoke apache2 reload >&2
fi
)