diff options
Diffstat (limited to 'debian/debconf.gamla/exim4-base.postinst')
-rw-r--r-- | debian/debconf.gamla/exim4-base.postinst | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/debian/debconf.gamla/exim4-base.postinst b/debian/debconf.gamla/exim4-base.postinst new file mode 100644 index 0000000..eacc8f7 --- /dev/null +++ b/debian/debconf.gamla/exim4-base.postinst @@ -0,0 +1,92 @@ +#!/bin/sh + +set -e +. /usr/share/debconf/confmodule + +db_version 2.0 + +get_value() { + db_get $1 + code="$?" + if [ "$code" -eq "0" ]; then + : + else + echo "Error getting debconf answer $1: debconf code=$code" >&2 + exit $code + fi +} + +case "$1" in + configure) + # Create directories for log etc + install -d -omail -gadm -m2750 /var/log/exim4 + install -d -omail -gmail /var/run/exim4 + + # Check that db files are readable by this Exim's db library + dbfiles="" + for f in /var/spool/exim/db/*; do + if [ -f "$f" ]; then + if echo $f | grep \.lockfile\$ >/dev/null 2>&1; then + : # ignore lock files + else + dbfiles="$dbfiles `basename $f`" + fi + fi + done + for dbfile in $dbfiles; do + if exim_dumpdb /var/spool/exim $dbfile >/dev/null 2>&1; then + : # File OK + else + echo "Resetting invalid $dbfile hints db" + rm -f /var/spool/exim/db/$dbfile /var/spool/exim/db/$dbfile.* + fi + done + + # Configure Exim + get_value exim/configconvert/question + convertanswer="$RET" + if [ -f /etc/exim4/exim4.conf ]; then + : # nothing: leave existing config alone + elif [ "$convertanswer" = "convert" ]; then + /usr/lib/exim4/convert4r4 < /etc/exim/exim.conf > /etc/exim4/exim4.conf + elif [ "$convertanswer" = "createnew" ]; then + /usr/lib/exim4/debconf_eximconfig + fi + + if [ -x "/etc/init.d/exim4" ]; then + update-rc.d exim4 defaults >/dev/null + fi + + get_value exim/daemon/permissions + case "$RET" in + "setuid root") + if ! dpkg-statoverride --list /usr/sbin/exim4 >/dev/null; then + dpkg-statoverride --update --add root root 4755 /usr/sbin/exim4 + fi + ;; + "setuid mail") + if ! dpkg-statoverride --list /usr/sbin/exim4 >/dev/null; then + dpkg-statoverride --update --add mail root 4755 /usr/sbin/exim4 + fi + ;; + "none") + if ! dpkg-statoverride --list /usr/sbin/exim4 >/dev/null; then + dpkg-statoverride --update --remove /usr/sbin/exim4 + fi + ;; + *) + echo "Error: Wrong answer for exim/daemon/permissions: $RET" >&3 + exit 1; + ;; + esac + + if [ -x /usr/sbin/invoke-rc.d ]; then + invoke-rc.d exim4 start + else + /etc/init.d/exim4 start + fi + + ;; +esac + +#DEBHELPER# |