masqmail

view debian/masqmail.config @ 0:08114f7dcc23

this is masqmail-0.2.21 from oliver kurth
author meillo@marmaro.de
date Fri, 26 Sep 2008 17:05:23 +0200
parents
children af25f5c39d90
line source
1 #!/bin/bash -e
3 # Source debconf library.
4 . /usr/share/debconf/confmodule
6 db_version 2.0
8 # This conf script is capable of backing up
9 db_capb backup
11 if [ x"$1" = x"configure" ] ; then
12 if [ -n $2 ] ; then
13 if dpkg --compare-versions "$2" lt "0.2.10-0.2" ; then
14 PCMCIA_SCRIPT_UP=/etc/pcmcia/ip-up.d/1masqmail
15 PCMCIA_SCRIPT_DOWN=/etc/pcmcia/ip-down.d/99masqmail
16 if [ -x $PCMCIA_SCRIPT_UP ] || [ -x $PCMCIA_SCRIPT_DOWN ] ; then
17 chmod -x $PCMCIA_SCRIPT_UP $PCMCIA_SCRIPT_DOWN
18 db_input high masqmail/note_pcmcia_scripts || true;
19 db_go
20 fi
21 fi
22 fi
23 fi
25 if [ x"$1" = x"configure" ] ; then
26 if [ -n $2 ] ; then
27 if dpkg --compare-versions "$2" lt "0.2.17-1" ; then
28 db_input medium masqmail/note_moved_tpl || true;
29 db_go
30 fi
31 fi
32 fi
34 # shamelessly copied from xserver-common.config.
35 # Thanks to Branden. :-)
37 CONFIGFILE=/etc/masqmail/masqmail.conf
39 ASK_TO_REPLACE=
40 if [ -e $CONFIGFILE ]; then
41 # does the file have debconf markers in it?
42 if egrep -q '^### BEGIN DEBCONF SECTION' $CONFIGFILE && \
43 egrep -q '^### END DEBCONF SECTION' $CONFIGFILE; then
44 PRIORITY=medium
45 else
46 ASK_TO_REPLACE=yes
47 PRIORITY=high
48 fi
49 else
50 PRIORITY=medium
51 # this is for the postinst, which tests this:
52 db_set masqmail/move_existing_nondebconf_config "true"
53 fi
55 # use debconf to manage configuration file?
56 db_input $PRIORITY masqmail/manage_config_with_debconf || true
57 db_go
58 db_get masqmail/manage_config_with_debconf
59 if [ "$RET" = "false" ]; then
60 exit 0
61 fi
63 # move existing configuration file out of
64 # the way?
65 if [ x"$ASK_TO_REPLACE" = x"yes" ]; then
66 db_input $PRIORITY masqmail/move_existing_nondebconf_config || true
67 db_go
68 db_get masqmail/move_existing_nondebconf_config || true
69 if [ "$RET" = "true" ]; then
70 mv $CONFIGFILE $CONFIGFILE.debconf-backup
71 else
72 exit 0
73 fi
74 fi
76 if [ -f /etc/mailname ] ; then
77 hostfqdn=`cat /etc/mailname`
78 else
79 hostfqdn=`hostname -f`
80 fi
81 hostname=`hostname`
83 db_fget masqmail/host_name seen
84 if [ "$RET" = "false" ]; then
85 db_set masqmail/host_name ${hostfqdn}
86 fi
87 db_fget masqmail/local_hosts seen
88 if [ "$RET" = "false" ]; then
89 db_set masqmail/local_hosts "localhost;${hostname};${hostfqdn}"
90 fi
92 STATE=1
93 while [ "$STATE" != 0 -a "$STATE" != 19 ]; do
94 case "$STATE" in
95 1)
96 db_input medium masqmail/host_name || true
97 ;;
98 2)
99 db_input medium masqmail/local_hosts || true
100 ;;
101 3)
102 db_input medium masqmail/local_nets || true
103 ;;
104 4)
105 db_input medium masqmail/listen_addresses || true
106 ;;
107 5)
108 db_input low masqmail/use_syslog || true
109 ;;
110 6)
111 db_input medium masqmail/online_detect || true
112 ;;
113 7)
114 db_get masqmail/online_detect
115 if [ "$RET" = "file" ] ; then
116 db_input low masqmail/online_file || true
117 else
118 db_input medium masqmail/online_pipe || true
119 fi
120 ;;
121 8)
122 db_input medium masqmail/mbox_default || true
123 ;;
124 9)
125 db_get masqmail/mbox_default
126 if [ "$RET" = "mda" ] ; then
127 db_input medium masqmail/mda || true
128 else
129 db_input low masqmail/mda || true
130 fi
131 ;;
132 10)
133 db_input low masqmail/alias_local_caseless || true
134 ;;
135 11)
136 db_input low masqmail/init_smtp_daemon || true
137 ;;
138 12)
139 db_input low masqmail/init_queue_daemon || true
140 ;;
141 13)
142 db_get masqmail/init_queue_daemon
143 if [ "$RET" = "true" ] ; then
144 db_input low masqmail/queue_daemon_ival || true
145 fi
146 ;;
147 14)
148 db_input medium masqmail/init_fetch_daemon || true
149 ;;
150 15)
151 db_get masqmail/init_fetch_daemon
152 if [ "$RET" = "true" ] ; then
153 db_input low masqmail/fetch_daemon_ival || true
154 fi
155 ;;
156 16)
157 db_input medium masqmail/ipup_runqueue || true
158 ;;
159 17)
160 db_input medium masqmail/ipup_fetch || true
161 ;;
162 18)
163 db_input medium masqmail/ifup_ifaces || true
164 ;;
166 esac
168 if db_go; then
169 STATE=$(($STATE + 1))
170 else
171 STATE=$(($STATE - 1))
172 fi
173 done
175 db_input medium masqmail/you_are_not_finished || true
176 db_go
178 # dpkg-reconfigure does not stop services:
179 # (cause of Bug#151528)
180 # in debhelper version < 1.2.9
182 DH_VERSION=`dpkg -l debconf | awk ' /^ii/ { print $3 }'`
184 if dpkg --compare-versions $DH_VERSION lt "1.2.9" ; then
185 if [ x"$1" = x"reconfigure" ] ; then
186 if [ -x "/etc/init.d/masqmail" ]; then
187 /etc/init.d/masqmail stop || true
188 fi
189 fi
190 fi
192 exit 0