brought Univention packaging in sync with Debian packaging
authorLars Kneschke <l.kneschke@metaways.de>
Fri, 4 Jan 2013 10:08:20 +0000 (11:08 +0100)
committerLars Kneschke <l.kneschke@metaways.de>
Fri, 4 Jan 2013 10:11:21 +0000 (11:11 +0100)
Change-Id: I8369d4af4ccb201f035c254a5ea56dc6a3350bb2

scripts/packaging/Univention/debian/tine20-webstack.config [new file with mode: 0644]
scripts/packaging/Univention/debian/tine20-webstack.postinst
scripts/packaging/Univention/debian/tine20-webstack.postrm
scripts/packaging/Univention/debian/tine20-webstack.templates [new file with mode: 0644]
scripts/packaging/Univention/debian/tine20.postinst
scripts/packaging/debian/tine20-webstack.postinst
scripts/packaging/debian/tine20-webstack.postrm
scripts/packaging/debian/tine20-webstack.templates

diff --git a/scripts/packaging/Univention/debian/tine20-webstack.config b/scripts/packaging/Univention/debian/tine20-webstack.config
new file mode 100644 (file)
index 0000000..f107dee
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash 
+
+set -e
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+db_version 2.0
+
+db_input high tine20/webserver_type || true
+
+db_go || true
+
index 9465957..d6f0559 100644 (file)
@@ -35,56 +35,79 @@ db_version 2.0
 if [ "$1" = "configure" ]; then
 
     # setup webserver
-    webservers="apache2"
+    db_get tine20/webserver_type
+    webserver="$RET"
     
-    if [ "$webservers" != "" ]; then
+    case "$webserver" in
+        apache2)
+            # check if webserver is installed
+            if [ -x /usr/sbin/$webserver ]; then 
 
-        for webserver in $webservers; do
-            webserver=${webserver%,}
+                if [ -d /etc/apache2/mods-enabled ]; then
+                    if [ ! -f /etc/apache2/mods-enabled/rewrite.load -a ! -h /etc/apache2/mods-enabled/rewrite.load ]; then
+                        /usr/sbin/a2enmod rewrite
+                    fi
+                    if [ ! -f /etc/apache2/mods-enabled/expires.load -a ! -h /etc/apache2/mods-enabled/expires.load ]; then
+                        /usr/sbin/a2enmod expires
+                    fi
+                    if [ -f /etc/apache2/mods-available/php5.load ]; then
+                        if [ ! -f /etc/apache2/mods-enabled/php5.load -a ! -h /etc/apache2/mods-enabled/php5.load ]; then
+                            /usr/sbin/a2enmod php5
+                        fi 
+                    fi
+                fi
+    
+                # create vhost configuration links
+                servers="apache2"
+                linkdestination_apache="../../tine20/apache.conf"
+                linkname="tine20"
+    
+                if [ -e /usr/share/wwwconfig-common/confd-link.sh ]; then
+                    . /usr/share/wwwconfig-common/confd-link.sh
+                fi
+                
+                # mark webserver for restart (used by restart.sh)
+                restart="$restart $webserver"
             
+            fi
+            ;;
+            
+        lighttpd)
             # check if webserver is installed
-            test -x /usr/sbin/$webserver || continue
+            if [ -x /usr/sbin/$webserver ]; then 
+
+                # create vhost configuration links
+                servers="$webserver"
+                linkdestination_lighttpd="../../tine20/lighttpd.conf"
+                linkname="15-tine20.conf"
     
-            case "$webserver" in
-                apache2)
-                    if [ -d /etc/apache2/mods-enabled ]; then
-                        if [ ! -f /etc/apache2/mods-enabled/rewrite.load -a ! -h /etc/apache2/mods-enabled/rewrite.load ]; then
-                            /usr/sbin/a2enmod rewrite
-                        fi
-                        if [ ! -f /etc/apache2/mods-enabled/expires.load -a ! -h /etc/apache2/mods-enabled/expires.load ]; then
-                            /usr/sbin/a2enmod expires
-                        fi
-                        if [ -f /etc/apache2/mods-available/php5.load ]; then
-                            if [ ! -f /etc/apache2/mods-enabled/php5.load -a ! -h /etc/apache2/mods-enabled/php5.load ]; then
-                                /usr/sbin/a2enmod php5
-                            fi 
-                        fi
+                if [ -e /usr/share/wwwconfig-common/confd-link.sh ]; then
+                    . /usr/share/wwwconfig-common/confd-link.sh
+                fi
+                
+                if [ -d /etc/$webserver/conf-available ]; then
+                    if [ ! -f /etc/$webserver/conf-enabled/10-expire.conf -a ! -h /etc/$webserver/conf-enabled/10-expire.conf ]; then
+                        /usr/sbin/lighttpd-enable-mod expire
                     fi
-
-                    # create vhost configuration links
-                    servers="apache2"
-                    linkdestination_apache="../../tine20/apache.conf"
-                    linkname="tine20"
-        
-                    if [ -e /usr/share/wwwconfig-common/confd-link.sh ]; then
-                        . /usr/share/wwwconfig-common/confd-link.sh
+    
+                    if [ ! -f /etc/$webserver/conf-enabled/15-tine20.conf -a ! -h /etc/$webserver/conf-enabled/15-tine20.conf ]; then
+                        /usr/sbin/lighttpd-enable-mod tine20
                     fi
-                    
-                    # mark webserver for restart (used by restart.sh)
-                    restart="$restart $webserver"
-                    
-                    ;;
+                fi
                 
-            esac
+                # mark webserver for restart (used by restart.sh)
+                restart="$restart $webserver"
             
-        done
+            fi
+            ;;
         
-        # restart webserver
-        if [ -e /usr/share/wwwconfig-common/restart.sh ]; then
-            . /usr/share/wwwconfig-common/restart.sh
-        fi
+    esac
+    
+    # restart webserver
+    if [ -e /usr/share/wwwconfig-common/restart.sh ]; then
+        . /usr/share/wwwconfig-common/restart.sh
     fi
 
 fi
 
-exit 0
+exit 0
\ No newline at end of file
index f13985c..368ecf1 100644 (file)
@@ -34,32 +34,39 @@ fi
 db_version 2.0
 
 if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
-    webservers="apache2"
+    db_get tine20/webserver_type
+    webserver="$RET"
 
-    if [ "$webservers" != "" ]; then
+    # check if webserver is installed
+    test -x /usr/sbin/$webserver || continue
 
-        for webserver in $webservers; do
-            webserver=${webserver%,}
+    case "$webserver" in
+        apache2)
+            rm -f /etc/$webserver/conf.d/tine20
+            
+            # mark webserver for restart (used by restart.sh)
+            restart="$restart $webserver"
+            
+            ;;
+            
+        lighttpd)
+            if [ -f /etc/$webserver/conf-enabled/15-tine20.conf ]; then
+                /usr/sbin/lighttpd-disable-mod tine20
+                
+                # mark webserver for restart (used by restart.sh)
+                restart="$restart $webserver"
+            fi
+            
+            rm -f /etc/$webserver/conf-available/15-tine20.conf
+            
+            ;;
+    esac
 
-            # check if webserver is installed
-            test -x /usr/sbin/$webserver || continue
-    
-            case "$webserver" in
-                apache2)
-                    rm -f /etc/$webserver/conf.d/tine20
-                    
-                    # mark webserver for restart (used by restart.sh)
-                    restart="$restart $webserver"
-                    ;;
-            esac
-        done
-    
-        # restart webserver
-        if [ -e /usr/share/wwwconfig-common/restart.sh ]; then
-            . /usr/share/wwwconfig-common/restart.sh
-        fi
-        
+    # restart webserver
+    if [ -e /usr/share/wwwconfig-common/restart.sh ]; then
+        . /usr/share/wwwconfig-common/restart.sh
     fi
+    
 fi
 
 #DEBHELPER#
diff --git a/scripts/packaging/Univention/debian/tine20-webstack.templates b/scripts/packaging/Univention/debian/tine20-webstack.templates
new file mode 100644 (file)
index 0000000..d06a5da
--- /dev/null
@@ -0,0 +1,8 @@
+Template: tine20/webserver_type
+Type: select
+Choices: apache2, lighttpd
+Default: apache2
+_Description: Web server to reconfigure automatically:
+ If you do not select a web server to reconfigure automatically, Tine 2.0
+ will not be usable until you reconfigure your webserver to enable
+ Tine 2.0.
index 2538dc2..c7cd661 100644 (file)
@@ -59,14 +59,16 @@ if [ "$1" = "configure" ]; then
         chmod 0640       "$tine20ConfigFile"
         chown 0:www-data "$tine20ConfigFile"
 
+        setupuser="tine20setup"
+        setuppassword=$(makepasswd --minchars=10 --maxchars=15)
+
         mysqlpassword=$(cat "$mysqlPasswordFile")
+        
         sed -i -e "s/_DBC_DBSERVER_/localhost/g"    "$tine20ConfigFile"
         sed -i -e "s/_DBC_DBNAME_/tine20/g"         "$tine20ConfigFile"
         sed -i -e "s/_DBC_DBUSER_/tine20/g"         "$tine20ConfigFile"
         sed -i -e "s/_DBC_DBPASS_/$mysqlpassword/g" "$tine20ConfigFile"
-
-        setuppassword=$(makepasswd --minchars=10 --maxchars=15)
-        sed -i -e 's/_SETUPUSERNAME_/tine20setup/g'    "$tine20ConfigFile"
+        sed -i -e "s/_SETUPUSERNAME_/$setupuser/g"     "$tine20ConfigFile"
         sed -i -e "s/_SETUPPASSWORD_/$setuppassword/g" "$tine20ConfigFile"
     fi
     
index 37100cf..d6f0559 100644 (file)
@@ -36,80 +36,76 @@ if [ "$1" = "configure" ]; then
 
     # setup webserver
     db_get tine20/webserver_type
-    webservers="$RET"
+    webserver="$RET"
     
-    if [ "$webservers" != "" ]; then
-
-        for webserver in $webservers; do
-            webserver=${webserver%,}
-            
+    case "$webserver" in
+        apache2)
             # check if webserver is installed
-            test -x /usr/sbin/$webserver || continue
-    
-            case "$webserver" in
-                apache2)
-                    if [ -d /etc/apache2/mods-enabled ]; then
-                        if [ ! -f /etc/apache2/mods-enabled/rewrite.load -a ! -h /etc/apache2/mods-enabled/rewrite.load ]; then
-                            /usr/sbin/a2enmod rewrite
-                        fi
-                        if [ ! -f /etc/apache2/mods-enabled/expires.load -a ! -h /etc/apache2/mods-enabled/expires.load ]; then
-                            /usr/sbin/a2enmod expires
-                        fi
-                        if [ -f /etc/apache2/mods-available/php5.load ]; then
-                            if [ ! -f /etc/apache2/mods-enabled/php5.load -a ! -h /etc/apache2/mods-enabled/php5.load ]; then
-                                /usr/sbin/a2enmod php5
-                            fi 
-                        fi
-                    fi
+            if [ -x /usr/sbin/$webserver ]; then 
 
-                    # create vhost configuration links
-                    servers="apache2"
-                    linkdestination_apache="../../tine20/apache.conf"
-                    linkname="tine20"
-        
-                    if [ -e /usr/share/wwwconfig-common/confd-link.sh ]; then
-                        . /usr/share/wwwconfig-common/confd-link.sh
+                if [ -d /etc/apache2/mods-enabled ]; then
+                    if [ ! -f /etc/apache2/mods-enabled/rewrite.load -a ! -h /etc/apache2/mods-enabled/rewrite.load ]; then
+                        /usr/sbin/a2enmod rewrite
                     fi
-                    
-                    # mark webserver for restart (used by restart.sh)
-                    restart="$restart $webserver"
-                    
-                    ;;
-                    
-                lighttpd)
-
-                    # create vhost configuration links
-                    servers="$webserver"
-                    linkdestination_lighttpd="../../tine20/lighttpd.conf"
-                    linkname="15-tine20.conf"
-        
-                    if [ -e /usr/share/wwwconfig-common/confd-link.sh ]; then
-                        . /usr/share/wwwconfig-common/confd-link.sh
+                    if [ ! -f /etc/apache2/mods-enabled/expires.load -a ! -h /etc/apache2/mods-enabled/expires.load ]; then
+                        /usr/sbin/a2enmod expires
+                    fi
+                    if [ -f /etc/apache2/mods-available/php5.load ]; then
+                        if [ ! -f /etc/apache2/mods-enabled/php5.load -a ! -h /etc/apache2/mods-enabled/php5.load ]; then
+                            /usr/sbin/a2enmod php5
+                        fi 
                     fi
-                    
-                    if [ -d /etc/$webserver/conf-available ]; then
-                        if [ ! -f /etc/$webserver/conf-enabled/10-expire.conf -a ! -h /etc/$webserver/conf-enabled/10-expire.conf ]; then
-                            /usr/sbin/lighttpd-enable-mod expire
-                        fi
+                fi
+    
+                # create vhost configuration links
+                servers="apache2"
+                linkdestination_apache="../../tine20/apache.conf"
+                linkname="tine20"
+    
+                if [ -e /usr/share/wwwconfig-common/confd-link.sh ]; then
+                    . /usr/share/wwwconfig-common/confd-link.sh
+                fi
+                
+                # mark webserver for restart (used by restart.sh)
+                restart="$restart $webserver"
+            
+            fi
+            ;;
+            
+        lighttpd)
+            # check if webserver is installed
+            if [ -x /usr/sbin/$webserver ]; then 
 
-                        if [ ! -f /etc/$webserver/conf-enabled/15-tine20.conf -a ! -h /etc/$webserver/conf-enabled/15-tine20.conf ]; then
-                            /usr/sbin/lighttpd-enable-mod tine20
-                        fi
+                # create vhost configuration links
+                servers="$webserver"
+                linkdestination_lighttpd="../../tine20/lighttpd.conf"
+                linkname="15-tine20.conf"
+    
+                if [ -e /usr/share/wwwconfig-common/confd-link.sh ]; then
+                    . /usr/share/wwwconfig-common/confd-link.sh
+                fi
+                
+                if [ -d /etc/$webserver/conf-available ]; then
+                    if [ ! -f /etc/$webserver/conf-enabled/10-expire.conf -a ! -h /etc/$webserver/conf-enabled/10-expire.conf ]; then
+                        /usr/sbin/lighttpd-enable-mod expire
+                    fi
+    
+                    if [ ! -f /etc/$webserver/conf-enabled/15-tine20.conf -a ! -h /etc/$webserver/conf-enabled/15-tine20.conf ]; then
+                        /usr/sbin/lighttpd-enable-mod tine20
                     fi
-                    
-                    # mark webserver for restart (used by restart.sh)
-                    restart="$restart $webserver"
-                    
-                    ;;
+                fi
                 
-            esac
+                # mark webserver for restart (used by restart.sh)
+                restart="$restart $webserver"
             
-        done
+            fi
+            ;;
         
-        # restart webserver
-        if [ -e /usr/share/wwwconfig-common/restart.sh ]; then
-            . /usr/share/wwwconfig-common/restart.sh
-        fi
+    esac
+    
+    # restart webserver
+    if [ -e /usr/share/wwwconfig-common/restart.sh ]; then
+        . /usr/share/wwwconfig-common/restart.sh
     fi
 
 fi
index 6b98bba..368ecf1 100644 (file)
@@ -35,32 +35,38 @@ db_version 2.0
 
 if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
     db_get tine20/webserver_type
-    webservers="$RET"
+    webserver="$RET"
 
-    if [ "$webservers" != "" ]; then
+    # check if webserver is installed
+    test -x /usr/sbin/$webserver || continue
 
-        for webserver in $webservers; do
-            webserver=${webserver%,}
+    case "$webserver" in
+        apache2)
+            rm -f /etc/$webserver/conf.d/tine20
+            
+            # mark webserver for restart (used by restart.sh)
+            restart="$restart $webserver"
+            
+            ;;
+            
+        lighttpd)
+            if [ -f /etc/$webserver/conf-enabled/15-tine20.conf ]; then
+                /usr/sbin/lighttpd-disable-mod tine20
+                
+                # mark webserver for restart (used by restart.sh)
+                restart="$restart $webserver"
+            fi
+            
+            rm -f /etc/$webserver/conf-available/15-tine20.conf
+            
+            ;;
+    esac
 
-            # check if webserver is installed
-            test -x /usr/sbin/$webserver || continue
-    
-            case "$webserver" in
-                apache2)
-                    rm -f /etc/$webserver/conf.d/tine20
-                    
-                    # mark webserver for restart (used by restart.sh)
-                    restart="$restart $webserver"
-                    ;;
-            esac
-        done
-    
-        # restart webserver
-        if [ -e /usr/share/wwwconfig-common/restart.sh ]; then
-            . /usr/share/wwwconfig-common/restart.sh
-        fi
-        
+    # restart webserver
+    if [ -e /usr/share/wwwconfig-common/restart.sh ]; then
+        . /usr/share/wwwconfig-common/restart.sh
     fi
+    
 fi
 
 #DEBHELPER#
index 4f479b1..d06a5da 100644 (file)
@@ -1,6 +1,7 @@
 Template: tine20/webserver_type
-Type: multiselect
+Type: select
 Choices: apache2, lighttpd
+Default: apache2
 _Description: Web server to reconfigure automatically:
  If you do not select a web server to reconfigure automatically, Tine 2.0
  will not be usable until you reconfigure your webserver to enable