* integrate apache package.
authorWilfried Göesgens <willi@citadel.org>
Wed, 10 Jan 2007 21:46:55 +0000 (21:46 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 10 Jan 2007 21:46:55 +0000 (21:46 +0000)
  * finetune the config script
  * don't use Webcits TinyMCE, as there is a debian package out there.
  * move our templates to /usr/share/webcit/

webcit/debian/changelog
webcit/debian/citadel-webcit.config
webcit/debian/citadel-webcit.postinst
webcit/debian/citadel-webcit.templates
webcit/debian/control
webcit/debian/webcit.init

index 7e3ddf8adc867a2ec4c7d91dc6c02a6b6b498f2a..ed0c2d7a84a3a1fc099ed1f09202317dadf6b87e 100644 (file)
@@ -1,7 +1,9 @@
 webcit (7.02-3) unstable; urgency=high
-       
-  * purge TinyMCE, as there is a debian package out there.
-  * move our templates to /etc/citadel/www/
+
+  * integrate apache package. 
+  * finetune the config script
+  * don't use Webcits TinyMCE, as there is a debian package out there.
+  * move our templates to /usr/share/webcit/
   * use DESTDIR
   * remove ucf from package
   * add po-debconf to Build-Depends
index 9b01a7596474b7f0d4fd2682fcac0c4d7e39171e..efc7d7a3fd806f6b94e746ebc89e404a3e7d0fb8 100755 (executable)
@@ -3,15 +3,66 @@ set -e
 
 . /usr/share/debconf/confmodule
 
+if test -e /etc/default/webcit; then
+  source /etc/default/webcit
+else
+    export WEBCIT_CITADEL_IP=127.0.0.1
+    export WEBCIT_CITADEL_PORT=504
+fi
+
+db_capb backup 
+
 if test -n "$2"; then
- if test "`echo $2 | sed -e 's/[.-]//g'`" -lt 127 \
-         -o $1 = reconfigure
- then
-       db_input high citadel/WebcitHttpPort
-       db_input high citadel/WebcitHttpsPort
-       db_input high citadel/WebcitInstallnote
+    if test "`echo $2 | sed -e 's/[.-]//g'`" -lt 127 \
+       -o $1 = reconfigure
+       then
+       
+       
+       STATE=1
+       LASTSTATE=2
+       while [ "$STATE" != 0 -a "$STATE" -le "$LASTSTATE" ]; do
+           case "$STATE" in
+               1)
+                   db_input high citadel/WebcitApacheIntegration
+                   ;;
+               2)
+                   db_get citadel/WebcitApacheIntegration
+                   if test "$RET" = "Internal"; then
+                       db_input high citadel/WebcitHttpPort
+                   else
+                       db_set citadel/WebcitHttpPort 8504
+                   fi
+                   ;;
+               3)                   
+                   db_get citadel/WebcitApacheIntegration
+                   if test "$RET" = "Internal"; then
+                       db_input high citadel/WebcitHttpsPort
+                       db_set citadel/WebcitBindIp 0.0.0.0
+                   else
+                       db_set citadel/WebcitHttpsPort -1
+                       db_set citadel/WebcitBindIp 127.0.0.1
+                   fi
+                   ;;
+               4)
+                   db_input high citadel/WebcitInstallnote
+                   ;;
+           esac
+           if db_go; then
+               STATE=$(($STATE + 1))
+           else
+               STATE=$(($STATE - 1))
+           fi
+           
+       done
        db_go
- fi
+       db_get ciatdel/WebcitWebserver &&WWWTYPE="$RET"
+       db_get citadel/WebcitHttpPort && WEBCIT_HTTP_PORT="$RET"
+       db_get citadel/WebcitHttpsPort && WEBCIT_HTTPS_PORT="$RET"
+       db_get citadel/WebcitBindIp && WEBCIT_LISTEN_IP="$RET"
+       
+       set |grep WEBCIT |sed "s;^;export ;;" >/etc/default/webcit
+       
+    fi
 fi
 
 
index 75ea4bb28e9d53eadb38ce4fe28ec5c2c9e4aa88..bec157359f458bc3bf817f6e8b03fb458fdbd533 100644 (file)
@@ -13,22 +13,42 @@ case "$1" in
        if test ! -d /var/run/citadel/keys; then
                mkdir -p /var/run/citadel/keys
        fi
-       ln -sf /usr/share/tinymce/www /etc/citadel/www/tiny_mce
-       db_get citadel/WebcitHttpPort && http_port="$RET"
-       db_get citadel/WebcitHttpsPort && https_port="$RET"     
-
-       echo "aplying your settings"
-       echo "
-export WEBCIT_HTTP_PORT=$http_port
-export WEBCIT_HTTPS_PORT=$https_port
-export WEBCIT_CITADEL_IP=127.0.0.1
-export WEBCIT_CITADEL_PORT=504
-export WEBCIT_LISTEN_IP=0.0.0.0
-" >>/etc/default/webcit
 
+       db_get citadel/WebcitApacheIntegration &&WWWTYPE="$RET"
        db_stop
-       
+
        #DEBHELPER#
+       
+# update the webserver, if needed
+       case "$WWWTYPE" in
+           "Apache")
+               webservers="apache" 
+               aenmod proxy
+               ;;
+           "Apache-SSL")
+               webservers="apache-ssl" 
+               ;;
+           "Apache2")
+               webservers="apache2"
+               a2enmod proxy
+               ;;
+           "All")
+               webservers="apache apache-ssl apache2" 
+               ;;
+           *)
+               webservers="" 
+               ;;
+       esac
+
+       for server in $webservers; do
+           if [ -d "/etc/${server}/conf.d" ]; then
+               if [ ! -e "/etc/${server}/conf.d/webcit-citadel" ] ; then
+                   ln -s /etc/citadel/apache.conf "/etc/${server}/conf.d/webcit.conf"
+                fi
+                invoke-rc.d $server reload || true
+           fi
+       done
+
     ;;
   abort-upgrade|abort-remove|abort-deconfigure)
     ;;
index 7326103ac8362ea000e7b014bc4e4d87ca0d4c1b..e001d4ea2625f68d20eedb8224847a2c5a8f15a6 100644 (file)
@@ -1,3 +1,13 @@
+Template: citadel/WebcitApacheIntegration
+Type: select
+_Choices: Apache, Apache-SSL, Apache2, All, Internal
+Default: Internal
+_Description: Should Webcit be integrated in your Apache?
+  If you want Webcit to run alongside with one of your other installed 
+  Apache Webservers, select it from the list, else use Internal to make 
+  Webcit use its own HTTP Server Facilities.
+
+
 Template: citadel/WebcitHttpPort
 Type: string
 Default: 8504
index 8c1d98ddf1736db5f778ed78c2d22712441b50cf..c90c27c1ce3a2005159213511b9a34597c1492ab 100644 (file)
@@ -8,7 +8,7 @@ Standards-Version: 3.7.2
 
 Package: citadel-webcit
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, debconf, tinymce
+Depends: ${shlibs:Depends}, ${misc:Depends}, debconf, tinymce, citadel-common
 Suggests: citadel-server, apache2 | apache
 Description: web-based frontend to Citadel groupware server
  WebCit is a web-based, AJAX-enabled frontend to the Citadel groupware system.
index a9b0f1b9576dc4f04322a70108bcbe0ad327d47e..3e3521ba41f758cf7cfee67f7757c4f7e87a7590 100644 (file)
@@ -71,8 +71,6 @@ do_start()
            mkdir -p $LOGDIR
        fi
 
-
-
        # are we disabled?
        if test "$1" -lt "0"; then
            return 0
@@ -88,9 +86,6 @@ do_start()
        else
            return 2
        fi
-       # Add code here, if necessary, that waits for the process to be ready
-       # to handle requests from services started subsequently which depend
-       # on this one.  As a last resort, sleep for some time.
 }
 
 #
@@ -98,47 +93,13 @@ do_start()
 #
 do_stop()
 {
-       # Return
-       #   0 if daemon has been stopped
-       #   1 if daemon was already stopped
-       #   2 if daemon could not be stopped
-       #   other if a failure occurred
-
         for i in $PIDFILE.*; do if test -f $i; then
            kill `cat $i`
            rm -f $i
        fi; done
-
-       #while test -d /proc/`cat $PIDFILE`; do
-       #    /usr/bin/printf  '.'
-       #    /bin/sleep 1
-       #done
-       #start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
-       #RETVAL="$?"
-       #[ "$RETVAL" = 2 ] && return 2
-       # Wait for children to finish too if this is a daemon that forks
-       # and if the daemon is only ever run from this initscript.
-       # If the above conditions are not satisfied then add some other code
-       # that waits for the process to drop all resources that could be
-       # needed by services started subsequently.  A last resort is to
-       # sleep for some time.
-       #start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
-       #[ "$?" = 2 ] && return 2
-       # Many daemons don't delete their pidfiles when they exit.
-       # rm -f $PIDFILE
 }
 
-#
-# Function that sends a SIGHUP to the daemon/service
-#
 do_reload() {
-       #
-       # If the daemon can reload its configuration without
-       # restarting (for example, when it is sent a SIGHUP),
-       # then implement that here.
-       #
-#      start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
         do_stop
         do_start
        return 0
@@ -176,20 +137,7 @@ case "$1" in
            esac
        fi
        ;;
-  #reload|force-reload)
-       #
-       # If do_reload() is not implemented then leave this commented out
-       # and leave 'force-reload' as an alias for 'restart'.
-       #
-       #log_daemon_msg "Reloading $DESC" "$NAME"
-       #do_reload
-       #log_end_msg $?
-       #;;
   restart|force-reload)
-       #
-       # If the "reload" option is implemented then remove the
-       # 'force-reload' alias
-       #
        if test -n "$MODERN"; then
        log_daemon_msg "Restarting $DESC" "$NAME"
        else
@@ -213,10 +161,11 @@ case "$1" in
                    log_end_msg 1
                    ;;
            esac
+       else
+           do_start
        fi
        ;;
   *)
-       #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;