~ubuntu-branches/debian/squeeze/sympa/squeeze

« back to all changes in this revision

Viewing changes to debian/config

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Hornburg (Racke)
  • Date: 2004-04-29 01:04:22 UTC
  • Revision ID: james.westby@ubuntu.com-20040429010422-mz4bdfe39p4edznv
Tags: 3.4.4.3-6
* create system group for sympa instead of a regular one 
  (Closes: #246416, thanks to Martin Theiss <mtheiss@neo.wh-stuttgart.de>)
* updated Brazilian Portuguese debconf template translation
  (Closes: #228249, thanks to Andre Luis Lopes <andrelop@debian.org>)
* added Catalan debconf template translation (Closes: #236647, thanks to
  Aleix Badia i Bosch <abadia@ica.es>)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
 
 
3
# Debconf configuration script for Sympa.
 
4
# by Jerome Marant <jerome@debian.org>
 
5
 
 
6
# Modifications by Stefan Hornburg (Racke) <racke@linuxia.de>.
 
7
 
 
8
# Source debconf library
 
9
. /usr/share/debconf/confmodule
 
10
 
 
11
db_version 2.0
 
12
 
 
13
if [ "$1" = "reconfigure" ]; then
 
14
    # Reinitialize passwords
 
15
    db_reset sympa/key_password
 
16
 
 
17
    db_reset sympa/key_password_again
 
18
 
 
19
    # Reinitialize passwords
 
20
    db_reset sympa/db_passwd
 
21
 
 
22
    db_reset sympa/db_passwd_again
 
23
fi
 
24
 
 
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`
 
29
    case $lang in
 
30
        "cn-big5" | "tw")
 
31
            lang="Traditional Chinese"
 
32
            ;;
 
33
        "cn-gb" | "cn")
 
34
            lang="Simplified Chinese"
 
35
            ;;
 
36
        "cz")
 
37
            lang="Czech"
 
38
            ;;
 
39
        "us")
 
40
            lang="English"
 
41
            ;;
 
42
        "et")
 
43
            lang="Estonian"
 
44
            ;;
 
45
        "fi")
 
46
            lang="Finnish"
 
47
            ;;
 
48
        "fr")
 
49
            lang="French"
 
50
            ;;
 
51
        "de")
 
52
            lang="German"
 
53
            ;;
 
54
        "hu")
 
55
            lang="Hungarian"
 
56
            ;;
 
57
        "it")
 
58
            lang="Italian"
 
59
            ;;
 
60
        "pl")
 
61
            lang="Polish"
 
62
            ;;
 
63
        "ro")
 
64
            lang="Romanian"
 
65
            ;;
 
66
        "es")
 
67
            lang="Spanish"
 
68
            ;;
 
69
        *)
 
70
            lang="English"
 
71
    esac
 
72
    db_set sympa/language "$lang"
 
73
 
 
74
    # Get the hostname.
 
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;
 
81
                             }
 
82
                             else {
 
83
                                 print \$1;
 
84
                             }
 
85
                         }
 
86
                        ' $conf`
 
87
    else
 
88
        host=`perl -nle 'if (/^\s*domain\s+(.*)\$/) {
 
89
                             if (\$1 =~ m/^\`(.*)\`\$/) {
 
90
                                 \$cmd=\`\$1\`; print \$cmd;
 
91
                             }
 
92
                             else {
 
93
                                 print \$1;
 
94
                             }
 
95
                         }
 
96
                        ' $conf`
 
97
    fi
 
98
 
 
99
    # Get the listmasters
 
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;
 
105
                               }
 
106
                               else {
 
107
                                   print \$1;
 
108
                               }
 
109
                           }
 
110
                          ' $conf`
 
111
else
 
112
    # Get default values on configure
 
113
    host=`/bin/cat /etc/mailname || /bin/hostname -f || echo localhost`
 
114
 
 
115
    listmaster=
 
116
fi
 
117
 
 
118
# Set default values
 
119
 
 
120
 
 
121
 
 
122
 
 
123
 
 
124
# Display the welcome message
 
125
db_input high sympa/welcome || true
 
126
db_go
 
127
 
 
128
# Ask for language
 
129
db_input medium sympa/language || true
 
130
db_go
 
131
 
 
132
db_set sympa/hostname "$host"
 
133
db_input medium sympa/hostname || true
 
134
db_go
 
135
 
 
136
db_get sympa/hostname
 
137
if [ "$listmaster" ]; then
 
138
        db_set sympa/listmaster "$listmaster"
 
139
else
 
140
        db_set sympa/listmaster "listmaster@$RET"
 
141
fi
 
142
db_input medium sympa/listmaster || true
 
143
db_go
 
144
 
 
145
# Ask for S/MIME configuration
 
146
db_input medium sympa/smime_support || true
 
147
db_go
 
148
 
 
149
db_get sympa/smime_support
 
150
smime="$RET"
 
151
 
 
152
if [ "$smime" = "true" ]; then
 
153
    pass_ok="false"
 
154
 
 
155
    while [ "$pass_ok" != "true" ]; do
 
156
        # Ask for key password
 
157
        db_input critical sympa/key_password || true
 
158
        db_go
 
159
 
 
160
        db_get sympa/key_password
 
161
        password="$RET"
 
162
 
 
163
        if [ -z "$password" ]; then
 
164
            continue
 
165
        fi
 
166
 
 
167
        db_input critical sympa/key_password_again || true
 
168
        db_go
 
169
 
 
170
        db_get sympa/key_password_again
 
171
        password_again="$RET"
 
172
 
 
173
        if [ "$password" != "$password_again" ]; then
 
174
            continue
 
175
        fi
 
176
 
 
177
        pass_ok="true"
 
178
    done
 
179
fi
 
180
 
 
181
# Ask for spool dir removal
 
182
db_input medium sympa/remove_spool || true
 
183
db_go
 
184
 
 
185
# Ask for the use of a databse
 
186
db_input medium sympa/use_db || true
 
187
db_go
 
188
 
 
189
db_get sympa/use_db
 
190
use_db="$RET"
 
191
 
 
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
 
197
 
 
198
            db_type=`perl -nle 'if (/^\s*db_type\s+(.*)$/) {print $1;}' $conf`
 
199
            if [ -n "$db_type" ]; then
 
200
                case "$db_type" in
 
201
                    "mysql")
 
202
                        db_type="MySQL"
 
203
                        ;;
 
204
                    "Pg"|*)
 
205
                        db_type="PostgreSQL"
 
206
                        ;;
 
207
                esac
 
208
                db_set sympa/db_type "$db_type"
 
209
            fi
 
210
 
 
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"
 
214
            fi
 
215
            
 
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"
 
219
            fi
 
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"
 
224
                fi
 
225
                 
 
226
            fi
 
227
 
 
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"
 
232
            fi
 
233
 
 
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"
 
237
            fi
 
238
        fi
 
239
    fi
 
240
 
 
241
    db_input high sympa/db_type || true
 
242
    db_go
 
243
 
 
244
    db_input high sympa/db_hostname || true
 
245
    db_go
 
246
 
 
247
    db_get sympa/db_hostname
 
248
    db_hostname="$RET"
 
249
    if [ "$db_hostname" != "localhost" ]; then
 
250
        db_get sympa/db_port
 
251
        db_port="$RET"
 
252
        
 
253
        db_get sympa/db_type
 
254
        db_type="$RET"
 
255
        db_subst sympa/db_port database "$db_type"
 
256
 
 
257
        pass_required=1
 
258
 
 
259
        case "$db_type" in
 
260
        "MySQL")
 
261
            if [ -z "$db_port" ]; then
 
262
                        db_port=3306
 
263
                db_set sympa/db_port $db_port
 
264
            fi
 
265
                if [ "db_hostname" = "localhost" ]; then
 
266
                        if mysql -p $db_port mysql </dev/null; then
 
267
                                pass_required=0
 
268
                        fi
 
269
                fi
 
270
            ;;
 
271
        "PostgreSQL"|*)
 
272
            db_subst sympa/db_port database ""
 
273
            if [ -z "$db_port" ]; then
 
274
                db_set sympa/db_port "5432"
 
275
            fi
 
276
            ;;
 
277
        esac
 
278
 
 
279
        db_input medium sympa/db_port || true
 
280
        db_go
 
281
    fi
 
282
 
 
283
    db_input medium sympa/db_name || true
 
284
    db_go
 
285
 
 
286
    pass_ok="false"
 
287
 
 
288
    while [ "$pass_ok" != "true" ]; do
 
289
        # Ask for password
 
290
        db_input critical sympa/db_passwd || true
 
291
        db_go
 
292
 
 
293
        db_get sympa/db_passwd
 
294
        password="$RET"
 
295
        
 
296
        # Ask for password again
 
297
        db_input critical sympa/db_passwd_again || true
 
298
        db_go
 
299
 
 
300
        db_get sympa/db_passwd_again
 
301
        password_again="$RET"
 
302
 
 
303
        # If password are not equals, loop again
 
304
        if [ "$password" != "$password_again" ]; then
 
305
            continue
 
306
        fi
 
307
 
 
308
        pass_ok="true"
 
309
    done
 
310
 
 
311
    db_input medium sympa/db_options || true
 
312
    db_go
 
313
 
 
314
#       if [ "$pass_required" = 0 ]; then
 
315
                db_input medium sympa/db_askifpassneeded || true
 
316
                db_go
 
317
                db_get sympa/db_askifpassneeded
 
318
                if [ "$RET" = "true" ]; then
 
319
                        pass_required=1
 
320
                        db_reset sympa/db_adminpasswd
 
321
                fi
 
322
#       fi
 
323
 
 
324
        if [ "$pass_required" = 1 ]; then
 
325
                # Ask for the admin password
 
326
                db_get sympa/db_type
 
327
                db_type="$RET"
 
328
                db_subst sympa/db_adminpasswd database "$db_type"
 
329
 
 
330
                db_input critical sympa/db_adminpasswd || true
 
331
                db_go
 
332
        fi
 
333
 
 
334
    db_input medium sympa/db_configured || true
 
335
    db_go
 
336
 
 
337
    db_input medium sympa/db_removeonpurge || true
 
338
    db_go
 
339
fi
 
340
 
 
341
# Get the url from sympa.conf
 
342
url=`echo -n 'http://'; hostname -f | tr -d "\n"; echo -n '/wws'`
 
343
 
 
344
db_subst sympa/use_wwsympa url "$url"
 
345
 
 
346
# Ask for WWSympa usage
 
347
db_input medium sympa/use_wwsympa || true
 
348
db_go
 
349
 
 
350
db_get sympa/use_wwsympa
 
351
use_wwsympa="$RET"
 
352
 
 
353
if [ "$use_wwsympa" = "true" ]; then
 
354
 
 
355
    conf='/etc/sympa/wwsympa.conf'
 
356
 
 
357
    if [ -f /etc/sympa/wwsympa.conf ]; then
 
358
        fastcgi=`perl -nle 'if (/^\s*use_fast_cgi\s+(\d)$/) {print $1;}' $conf`
 
359
        case $fastcgi in
 
360
            "1")
 
361
                fastcgi="true"
 
362
                ;;
 
363
            *)
 
364
                fastcgi="false"
 
365
                ;;
 
366
        esac
 
367
        db_set wwsympa/fastcgi "$fastcgi"
 
368
        
 
369
        title=`perl -nle 'if (/^\s*title\s+(.*)$/) {print $1;}' $conf`
 
370
        db_set wwsympa/title "$title"
 
371
        
 
372
        cookie_expire=`perl -nle 'if (/^\s*cookie_expire\s+(\d+)/) {print $1;}' $conf`
 
373
        db_set wwsympa/cookie_expire "$cookie_expire"
 
374
        
 
375
        cookie_domain=`perl -nle 'if (/^\s*cookie_domain\s+(.*)$/) {print $1;}' $conf`
 
376
        db_set wwsympa/cookie_domain "$cookie_domain"
 
377
    fi
 
378
 
 
379
    # Ask for the installed web server
 
380
    db_input high wwsympa/webserver_type || true
 
381
    db_go
 
382
 
 
383
    db_get wwsympa/webserver_type
 
384
    webserver="$RET"
 
385
 
 
386
    if [ $webserver != "none" ]; then
 
387
        # Ask for fastCGI configuration
 
388
        db_input medium wwsympa/fastcgi || true
 
389
        db_go
 
390
 
 
391
        db_input high wwsympa/webserver_modifconf || true
 
392
        db_go
 
393
 
 
394
        db_get wwsympa/webserver_modifconf
 
395
        modif="$RET"
 
396
 
 
397
        if [ "$modif" = "true" ]; then
 
398
            db_input high wwsympa/webserver_restart || true
 
399
            db_go
 
400
        fi
 
401
    fi
 
402
 
 
403
    # Ask for the web administration frontend title
 
404
    db_input low wwsympa/title || true
 
405
    db_go
 
406
 
 
407
    # Ask for the cookie domain
 
408
    db_input low wwsympa/cookie_domain || true
 
409
    db_go
 
410
 
 
411
    # Ask for the cookie expiration delay
 
412
    db_input low wwsympa/cookie_expire || true
 
413
    db_go
 
414
 
 
415
    # Ask for spool directories removal
 
416
    db_input medium wwsympa/remove_spool || true
 
417
    db_go
 
418
 
 
419
fi