3
# Debconf configuration script for Sympa.
4
# by Jerome Marant <jerome@debian.org>
6
# Modifications by Stefan Hornburg (Racke) <racke@linuxia.de>.
8
# Source debconf library
9
. /usr/share/debconf/confmodule
13
if [ "$1" = "reconfigure" ]; then
14
# Reinitialize passwords
15
db_reset sympa/key_password
17
db_reset sympa/key_password_again
19
# Reinitialize passwords
20
db_reset sympa/db_passwd
22
db_reset sympa/db_passwd_again
25
# Get the language value in case of a manual change
26
conf='/etc/sympa/sympa.conf'
27
if [ -f /etc/sympa/sympa.conf ]; then
28
lang=`perl -nle 'if (/^\s*lang\s+(\w+)/) {print $1;}' $conf`
31
lang="Traditional Chinese"
34
lang="Simplified Chinese"
72
db_set sympa/language "$lang"
75
# Since this parameter could be a unix command, we have
76
# to check this and run the command to get the value
77
if grep -q "^[ ]*host" /etc/sympa/sympa.conf ; then
78
host=`perl -nle 'if (/^\s*host\s+(.*)\$/) {
79
if (\$1 =~ m/^\`(.*)\`\$/) {
80
\$cmd=\`\$1\`; print \$cmd;
88
host=`perl -nle 'if (/^\s*domain\s+(.*)\$/) {
89
if (\$1 =~ m/^\`(.*)\`\$/) {
90
\$cmd=\`\$1\`; print \$cmd;
100
# Since this parameter could be a unix command, we have
101
# to check this and run the command to get the value
102
listmaster=`perl -nle 'if (/^\s*listmaster\s+(.*)\$/) {
103
if (\$1 =~ m/^\`(.*)\`\$/) {
104
\$cmd=\`\$1\`; print \$cmd;
112
# Get default values on configure
113
host=`/bin/cat /etc/mailname || /bin/hostname -f || echo localhost`
124
# Display the welcome message
125
db_input high sympa/welcome || true
129
db_input medium sympa/language || true
132
db_set sympa/hostname "$host"
133
db_input medium sympa/hostname || true
136
db_get sympa/hostname
137
if [ "$listmaster" ]; then
138
db_set sympa/listmaster "$listmaster"
140
db_set sympa/listmaster "listmaster@$RET"
142
db_input medium sympa/listmaster || true
145
# Ask for S/MIME configuration
146
db_input medium sympa/smime_support || true
149
db_get sympa/smime_support
152
if [ "$smime" = "true" ]; then
155
while [ "$pass_ok" != "true" ]; do
156
# Ask for key password
157
db_input critical sympa/key_password || true
160
db_get sympa/key_password
163
if [ -z "$password" ]; then
167
db_input critical sympa/key_password_again || true
170
db_get sympa/key_password_again
171
password_again="$RET"
173
if [ "$password" != "$password_again" ]; then
181
# Ask for spool dir removal
182
db_input medium sympa/remove_spool || true
185
# Ask for the use of a databse
186
db_input medium sympa/use_db || true
192
if [ "$use_db" = "true" ]; then
193
# Get old values if a database was configured for sympa < 3.0.3
194
if [ -f /etc/sympa/sympa.conf ]; then
195
if ! grep -q "#-- Database configuration" /etc/sympa/sympa.conf ; then
196
conf=/etc/sympa/sympa.conf
198
db_type=`perl -nle 'if (/^\s*db_type\s+(.*)$/) {print $1;}' $conf`
199
if [ -n "$db_type" ]; then
208
db_set sympa/db_type "$db_type"
211
db_name=`perl -nle 'if (/^\s*db_name\s+(.*)$/) {print $1;}' $conf`
212
if [ -n "$db_name" ]; then
213
db_set sympa/db_name "$db_name"
216
db_hostname=`perl -nle 'if (/^\s*db_hostname\s+(.*)$/) {print $1;}' $conf`
217
if [ -n "$db_hostname" ]; then
218
db_set sympa/db_hostname "$db_hostname"
220
if [ "$db_hostname" != "localhost" ]; then
221
db_port=`perl -nle 'if (/^\s*db_port\s+(.*)$/) {print $1;}' $conf`
222
if [ -n "$db_port" ]; then
223
db_set sympa/db_port "$db_port"
228
db_passwd=`perl -nle 'if (/^\s*db_passwd\s+(.*)$/) {print $1;}' $conf`
229
if [ -n "$db_passwd" ]; then
230
db_set sympa/db_passwd "$db_passwd"
231
db_set sympa/db_passwd_again "$db_passwd"
234
db_options=`perl -nle 'if (/^\s*db_options\s+(.*)$/) {print $1;}' $conf`
235
if [ -n "$db_options" ]; then
236
db_set sympa/db_options "$db_options"
241
db_input high sympa/db_type || true
244
db_input high sympa/db_hostname || true
247
db_get sympa/db_hostname
249
if [ "$db_hostname" != "localhost" ]; then
255
db_subst sympa/db_port database "$db_type"
261
if [ -z "$db_port" ]; then
263
db_set sympa/db_port $db_port
265
if [ "db_hostname" = "localhost" ]; then
266
if mysql -p $db_port mysql </dev/null; then
272
db_subst sympa/db_port database ""
273
if [ -z "$db_port" ]; then
274
db_set sympa/db_port "5432"
279
db_input medium sympa/db_port || true
283
db_input medium sympa/db_name || true
288
while [ "$pass_ok" != "true" ]; do
290
db_input critical sympa/db_passwd || true
293
db_get sympa/db_passwd
296
# Ask for password again
297
db_input critical sympa/db_passwd_again || true
300
db_get sympa/db_passwd_again
301
password_again="$RET"
303
# If password are not equals, loop again
304
if [ "$password" != "$password_again" ]; then
311
db_input medium sympa/db_options || true
314
# if [ "$pass_required" = 0 ]; then
315
db_input medium sympa/db_askifpassneeded || true
317
db_get sympa/db_askifpassneeded
318
if [ "$RET" = "true" ]; then
320
db_reset sympa/db_adminpasswd
324
if [ "$pass_required" = 1 ]; then
325
# Ask for the admin password
328
db_subst sympa/db_adminpasswd database "$db_type"
330
db_input critical sympa/db_adminpasswd || true
334
db_input medium sympa/db_configured || true
337
db_input medium sympa/db_removeonpurge || true
341
# Get the url from sympa.conf
342
url=`echo -n 'http://'; hostname -f | tr -d "\n"; echo -n '/wws'`
344
db_subst sympa/use_wwsympa url "$url"
346
# Ask for WWSympa usage
347
db_input medium sympa/use_wwsympa || true
350
db_get sympa/use_wwsympa
353
if [ "$use_wwsympa" = "true" ]; then
355
conf='/etc/sympa/wwsympa.conf'
357
if [ -f /etc/sympa/wwsympa.conf ]; then
358
fastcgi=`perl -nle 'if (/^\s*use_fast_cgi\s+(\d)$/) {print $1;}' $conf`
367
db_set wwsympa/fastcgi "$fastcgi"
369
title=`perl -nle 'if (/^\s*title\s+(.*)$/) {print $1;}' $conf`
370
db_set wwsympa/title "$title"
372
cookie_expire=`perl -nle 'if (/^\s*cookie_expire\s+(\d+)/) {print $1;}' $conf`
373
db_set wwsympa/cookie_expire "$cookie_expire"
375
cookie_domain=`perl -nle 'if (/^\s*cookie_domain\s+(.*)$/) {print $1;}' $conf`
376
db_set wwsympa/cookie_domain "$cookie_domain"
379
# Ask for the installed web server
380
db_input high wwsympa/webserver_type || true
383
db_get wwsympa/webserver_type
386
if [ $webserver != "none" ]; then
387
# Ask for fastCGI configuration
388
db_input medium wwsympa/fastcgi || true
391
db_input high wwsympa/webserver_modifconf || true
394
db_get wwsympa/webserver_modifconf
397
if [ "$modif" = "true" ]; then
398
db_input high wwsympa/webserver_restart || true
403
# Ask for the web administration frontend title
404
db_input low wwsympa/title || true
407
# Ask for the cookie domain
408
db_input low wwsympa/cookie_domain || true
411
# Ask for the cookie expiration delay
412
db_input low wwsympa/cookie_expire || true
415
# Ask for spool directories removal
416
db_input medium wwsympa/remove_spool || true