Import Debian changes 4.92-8+deb10u3
[hcoop/debian/exim4.git] / debian / exim4-daemon-light.postinst
1 #!/bin/sh
2
3 set -e
4
5 . /usr/share/debconf/confmodule
6
7 if [ -n "$EX4DEBUG" ]; then
8 echo "now debugging $0 $@"
9 set -x
10 fi
11
12 dc_eximconfig_configtype="other"
13 db_get exim4/dc_eximconfig_configtype || true
14 if [ "$RET" = "no configuration at this time" ]; then
15 dc_eximconfig_configtype="none"
16 fi
17
18 case "$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
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
44 if which certtool > /dev/null 2>&1 && \
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
57 ;;
58 esac
59
60 #DEBHELPER#