Merge branch 'debian'
[hcoop/debian/exim4.git] / debian / exim4-daemon-light.postinst
CommitLineData
de45f55a
AM
1#!/bin/sh
2
3set -e
4
5. /usr/share/debconf/confmodule
6
7if [ -n "$EX4DEBUG" ]; then
8 echo "now debugging $0 $@"
9 set -x
10fi
11
12dc_eximconfig_configtype="other"
13db_get exim4/dc_eximconfig_configtype || true
14if [ "$RET" = "no configuration at this time" ]; then
15 dc_eximconfig_configtype="none"
16fi
17
18case "$1" in
19 configure)
20
21 # || true is needed for succesfull installation with configtype 'none'
22 if [ -x /etc/init.d/exim4 ]; then
23 db_stop
24 if [ "$dc_eximconfig_configtype" = "none" ]; then
25 # we may have broken config here, ignore errors
26 invoke-rc.d exim4 start || true
27 else
28 # we must have working config here, honor errors
29 invoke-rc.d exim4 start
30 fi
31 fi
0baa7b9d
SB
32
33 # set up DH-parameter file, update if older than 160 days
34 if test -e /var/spool/exim4/gnutls-params-2048 ; then
35 if [ `stat --format=%Y /var/spool/exim4/gnutls-params-2048` -le $(( `date +%s` - 13824000 )) ];
36 then
37 echo "Updating GnuTLS DH parameter file" 1>&2
38 /usr/share/exim4/exim4_refresh_gnutls-params
39 fi
40 else
41 echo "Initializing GnuTLS DH parameter file" 1>&2
42 tempgnutls=$(tempfile --directory /var/spool/exim4 --mode 644 --prefix "gnutp")
43 chown Debian-exim:Debian-exim $tempgnutls
01e60269 44 if which certtool > /dev/null 2>&1 && \
0baa7b9d
SB
45 timeout --preserve-status --kill-after=15 120 \
46 certtool --generate-dh-params --bits 2048 > $tempgnutls ; then
47 mv $tempgnutls /var/spool/exim4/gnutls-params-2048
48 else
49 rm -f $tempgnutls
50 install -m 644 -o Debian-exim -g Debian-exim \
51 /usr/share/exim4/gnutls-params-2048 \
52 /var/spool/exim4/gnutls-params-2048
53 fi
54 fi
55
56
de45f55a
AM
57 ;;
58esac
59
60#DEBHELPER#