* resynced some functionality with pkg-citadel
[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 "`echo $2 | sed -e 's/[.-]//g'`" -lt 127 \
14         -o "$1" = reconfigure
15         then
16         DO_CONFIGURE=yes
17     fi
18 else 
19 # are we in first install?
20     if test "$1" = "configure"; then
21         DO_CONFIGURE=yes
22     fi
23 fi
24
25 if test "$DO_CONFIGURE" = "yes"; then
26     if test -e /etc/default/webcit; then
27         . /etc/default/webcit
28     else
29         export WEBCIT_CITADEL_IP=127.0.0.1
30         export WEBCIT_CITADEL_PORT=504
31     fi
32     STATE=1
33     LASTSTATE=5
34     while [ "$STATE" != 0 -a "$STATE" -le "$LASTSTATE" ]; do
35
36         case "$STATE" in
37             1)
38                 db_input high citadel/WebcitApacheIntegration || true
39                 db_go
40                 ;;
41             2)
42                 db_get citadel/WebcitApacheIntegration
43                 if test "$RET" = "Internal"; then
44                     db_input high citadel/WebcitHttpPort || true
45                 else
46                     db_set citadel/WebcitHttpPort 8504 || true
47                 fi
48                 ;;
49             3)               
50                 db_get citadel/WebcitApacheIntegration || true
51                 if test "$RET" = "Internal"; then
52                     db_input high citadel/WebcitHttpsPort || true
53                     export WEBCIT_LISTEN_IP=0.0.0.0
54                 else
55                     db_set citadel/WebcitHttpsPort -1
56                     export WEBCIT_LISTEN_IP=127.0.0.1
57                 fi
58                 ;;
59             4)
60                 db_input high citadel/WebcitOfferLang || true
61                 db_go
62                 ;;
63             5)
64                 db_input high citadel/WebcitInstallnote||true
65                 ;;
66         esac
67         if db_go; then
68             STATE=$(($STATE + 1))
69         else
70             STATE=$(($STATE - 1))
71         fi
72         
73     done
74     db_go
75     db_get citadel/WebcitHttpPort && WEBCIT_HTTP_PORT="$RET"
76     db_get citadel/WebcitHttpsPort && WEBCIT_HTTPS_PORT="$RET"
77     db_get citadel/WebcitBindIp && WEBCIT_LISTEN_IP="$RET"
78     db_get citadel/WebcitOfferLang && WEBCIT_LANG="$RET"
79     
80     db_get ciatdel/WebcitWebserver &&WWWTYPE="$RET"
81     if test "$WWWTYPE" = "Internal"; then
82         WEBCIT_APACHEFLAG=" "
83     else
84         WEBCIT_APACHEFLAG="-f"
85     fi
86
87     set |grep WEBCIT |sed "s;^;export ;;" >/etc/default/webcit
88 fi
89
90
91
92 exit 0