debian/masqmail-debian

view masqmail.config @ 14:92e4f8524471

updated translation: pt by Miguel Figueiredo (Closes Debian bug #504794
author meillo@marmaro.de
date Sun, 09 Nov 2008 19:53:29 +0100
parents 5ef519035828
children 845b243eb46f
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 # shamelessly copied from xserver-common.config.
12 # Thanks to Branden. :-)
14 CONFIGFILE=/etc/masqmail/masqmail.conf
16 ASK_TO_REPLACE=
17 if [ -e $CONFIGFILE ]; then
18 # does the file have debconf markers in it?
19 if egrep -q '^### BEGIN DEBCONF SECTION' $CONFIGFILE && \
20 egrep -q '^### END DEBCONF SECTION' $CONFIGFILE; then
21 PRIORITY=medium
22 else
23 ASK_TO_REPLACE=yes
24 PRIORITY=high
25 fi
26 else
27 PRIORITY=medium
28 # this is for the postinst, which tests this:
29 db_set masqmail/move_existing_nondebconf_config "true"
30 fi
32 # use debconf to manage configuration file?
33 db_input $PRIORITY masqmail/manage_config_with_debconf || true
34 db_go
35 db_get masqmail/manage_config_with_debconf
36 if [ "$RET" = "false" ]; then
37 exit 0
38 fi
40 # move existing configuration file out of
41 # the way?
42 if [ x"$ASK_TO_REPLACE" = x"yes" ]; then
43 db_input $PRIORITY masqmail/move_existing_nondebconf_config || true
44 db_go
45 db_get masqmail/move_existing_nondebconf_config || true
46 if [ "$RET" = "true" ]; then
47 mv $CONFIGFILE $CONFIGFILE.debconf-backup
48 else
49 exit 0
50 fi
51 fi
53 if [ -f /etc/mailname ] ; then
54 hostfqdn=`cat /etc/mailname`
55 elif [ `hostname -f 2>/dev/null` ] ; then
56 hostfqdn=`hostname -f`
57 fi
58 hostname=`hostname`
60 db_fget masqmail/host_name seen
61 if [ "$RET" = "false" ]; then
62 db_set masqmail/host_name ${hostfqdn}
63 fi
64 db_fget masqmail/local_hosts seen
65 if [ "$RET" = "false" ]; then
66 db_set masqmail/local_hosts "localhost;${hostname};${hostfqdn}"
67 fi
69 STATE=1
70 while [ "$STATE" != 0 -a "$STATE" != 19 ]; do
71 case "$STATE" in
72 1)
73 db_input medium masqmail/host_name || true
74 ;;
75 2)
76 db_input medium masqmail/local_hosts || true
77 ;;
78 3)
79 db_input medium masqmail/local_nets || true
80 ;;
81 4)
82 db_input medium masqmail/listen_addresses || true
83 ;;
84 5)
85 db_input low masqmail/use_syslog || true
86 ;;
87 6)
88 db_input medium masqmail/online_detect || true
89 ;;
90 7)
91 db_get masqmail/online_detect
92 if [ "$RET" = "file" ] ; then
93 db_input low masqmail/online_file || true
94 else
95 db_input medium masqmail/online_pipe || true
96 fi
97 ;;
98 8)
99 db_input medium masqmail/mbox_default || true
100 ;;
101 9)
102 db_get masqmail/mbox_default
103 if [ "$RET" = "mda" ] ; then
104 db_input medium masqmail/mda || true
105 else
106 db_input low masqmail/mda || true
107 fi
108 ;;
109 10)
110 db_input low masqmail/alias_local_caseless || true
111 ;;
112 11)
113 db_input low masqmail/init_smtp_daemon || true
114 ;;
115 12)
116 db_input low masqmail/init_queue_daemon || true
117 ;;
118 13)
119 db_get masqmail/init_queue_daemon
120 if [ "$RET" = "true" ] ; then
121 db_input low masqmail/queue_daemon_ival || true
122 fi
123 ;;
124 14)
125 db_input medium masqmail/init_fetch_daemon || true
126 ;;
127 15)
128 db_get masqmail/init_fetch_daemon
129 if [ "$RET" = "true" ] ; then
130 db_input low masqmail/fetch_daemon_ival || true
131 fi
132 ;;
133 16)
134 db_input medium masqmail/ipup_runqueue || true
135 ;;
136 17)
137 db_input medium masqmail/ipup_fetch || true
138 ;;
139 18)
140 db_input medium masqmail/ifup_ifaces || true
141 ;;
143 esac
145 if db_go; then
146 STATE=$(($STATE + 1))
147 else
148 STATE=$(($STATE - 1))
149 fi
150 done
152 # dpkg-reconfigure does not stop services:
153 # (cause of Bug#151528)
154 # in debhelper version < 1.2.9
156 DH_VERSION=`dpkg -l debconf | awk ' /^ii/ { print $3 }'`
158 if dpkg --compare-versions $DH_VERSION lt "1.2.9" ; then
159 if [ x"$1" = x"reconfigure" ] ; then
160 if which invoke-rc.d >/dev/null 2>&1; then
161 invoke-rc.d masqmail stop
162 else
163 if [ -x "/etc/init.d/masqmail" ]; then
164 /etc/init.d/masqmail stop || true
165 fi
166 fi
167 fi
168 fi
170 exit 0