ab2fe81e53c1d8be5614baee5251d0fa8246cc9d
[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=4
34     while [ "$STATE" != 0 -a "$STATE" -le "$LASTSTATE" ]; do
35
36         case "$STATE" in
37             1)
38         echo aou $STATE>>/tmp/bla
39                 db_input high citadel/WebcitApacheIntegration || true
40                 db_go
41         echo aou $STATE>>/tmp/bla
42                 ;;
43             2)
44                 db_get citadel/WebcitApacheIntegration
45                 if test "$RET" = "Internal"; then
46                     db_input high citadel/WebcitHttpPort || true
47                 else
48                     db_set citadel/WebcitHttpPort 8504 || true
49                 fi
50                 ;;
51             3)               
52                 db_get citadel/WebcitApacheIntegration || true
53                 if test "$RET" = "Internal"; then
54                     db_input high citadel/WebcitHttpsPort || true
55                     export WEBCIT_LISTEN_IP=0.0.0.0
56                 else
57                     db_set citadel/WebcitHttpsPort -1
58                     export WEBCIT_LISTEN_IP=127.0.0.1
59                 fi
60                 ;;
61             4)
62                 db_input high citadel/WebcitInstallnote||true
63                 ;;
64         esac
65         if db_go; then
66             STATE=$(($STATE + 1))
67         else
68             STATE=$(($STATE - 1))
69         fi
70         
71     done
72     db_go
73     db_get citadel/WebcitHttpPort && WEBCIT_HTTP_PORT="$RET"
74     db_get citadel/WebcitHttpsPort && WEBCIT_HTTPS_PORT="$RET"
75     db_get citadel/WebcitBindIp && WEBCIT_LISTEN_IP="$RET"
76     
77     db_get ciatdel/WebcitWebserver &&WWWTYPE="$RET"
78     if test "$WWWTYPE" = "Internal"; then
79         WEBCIT_APACHEFLAG=" "
80     else
81         WEBCIT_APACHEFLAG="-f"
82     fi
83
84     set |grep WEBCIT |sed "s;^;export ;;" >/etc/default/webcit
85 fi
86
87
88
89 exit 0