There can be only two.
[citadel.git] / webcit / debian / citadel-webcit.config
1 #!/bin/sh
2 set -e
3 . /usr/share/debconf/confmodule
4
5 db_version 2.0
6
7 db_capb backup 
8
9 DO_CONFIGURE=no
10
11 if test -n "$2"; then
12 # do we want to reconfigure?
13     if test "$1" = reconfigure; then
14         DO_CONFIGURE=yes
15     fi
16 else 
17 # are we in first install?
18     if test "$1" = "configure"; then
19         DO_CONFIGURE=yes
20     fi
21 fi
22
23 if test "$DO_CONFIGURE" = "yes"; then
24         if test -e /etc/default/webcit; then
25                 . /etc/default/webcit
26         else
27                 WEBCIT_APACHEFLAG=" "
28                 WEBCIT_HTTP_PORT=8504
29                 WEBCIT_HTTPS_PORT=-1
30                 WEBCIT_LANG=UNLIMITED
31         fi
32                 
33         if test "$WEBCIT_APACHEFLAG" = "-f"; then
34                 db_set citadel/WebcitApacheIntegration Apache2
35         else
36                 db_set citadel/WebcitApacheIntegration Internal
37         fi
38         db_set citadel/WebcitHttpPort $WEBCIT_HTTP_PORT
39         db_set citadel/WebcitHttpsPort $WEBCIT_HTTPS_PORT
40         db_set citadel/WebcitOfferLang $WEBCIT_LANG
41
42         STATE=1
43         LASTSTATE=5
44         while [ "$STATE" != 0 -a "$STATE" -le "$LASTSTATE" ]; do
45
46         case "$STATE" in
47             1)
48                 db_input high citadel/WebcitApacheIntegration || true
49                 ;;
50             2)
51                 db_get citadel/WebcitApacheIntegration
52                 if test "$RET" = "Internal"; then
53                     db_set citadel/WebcitHttpPort 80
54                     db_input high citadel/WebcitHttpPort || true
55                 fi
56                 ;;
57             3)
58                 db_get citadel/WebcitApacheIntegration
59                 if test "$RET" = "Internal"; then
60                     db_set citadel/WebcitHttpsPort 443
61                     db_input high citadel/WebcitHttpsPort || true
62                 fi
63                 ;;
64             4)
65                 db_input high citadel/WebcitOfferLang || true
66                 ;;
67             5)
68                 db_input high citadel/WebcitInstallnote||true
69                 ;;
70         esac
71         if db_go; then
72             STATE=$(($STATE + 1))
73         else
74             STATE=$(($STATE - 1))
75         fi
76
77         done
78     set |grep WEBCIT |sed "s;^;export ;;" >/etc/default/webcit
79 fi
80
81 exit 0