Updated Univention packaging
authorLars Kneschke <l.kneschke@metaways.de>
Wed, 23 Oct 2013 05:48:19 +0000 (07:48 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 23 Oct 2013 08:07:31 +0000 (10:07 +0200)
Change-Id: I49819230c4bab0f340c3a479eeaeeeb7ddb017be
Reviewed-on: https://gerrit.tine20.org/tine20/2451
Tested-by: jenkins user
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
19 files changed:
scripts/packaging/Univention/70tine20-ucs-udm.inst
scripts/packaging/Univention/conffiles/tine20-cfg.py
scripts/packaging/Univention/debian/changelog
scripts/packaging/Univention/debian/control
scripts/packaging/Univention/debian/etc/apache.conf
scripts/packaging/Univention/debian/etc/lighttpd.conf
scripts/packaging/Univention/debian/patches/config.inc.php.dist.diff
scripts/packaging/Univention/debian/patches/series
scripts/packaging/Univention/debian/patches/univention_ldap_settings.diff [deleted file]
scripts/packaging/Univention/debian/rules
scripts/packaging/Univention/debian/tine20-libraries.install
scripts/packaging/Univention/debian/tine20-tinebase.cron.d
scripts/packaging/Univention/debian/tine20-tinebase.install
scripts/packaging/Univention/debian/tine20-ucs-udm.postinst
scripts/packaging/Univention/debian/tine20-webstack.postinst
scripts/packaging/Univention/debian/tine20-webstack.postrm
scripts/packaging/Univention/debian/tine20.postinst
scripts/packaging/Univention/debian/tine20.postrm
scripts/packaging/debian/tine20.postinst

index cf989eb..caecea7 100755 (executable)
 
 VERSION="1"
 
-. /usr/share/univention-join/joinscripthelper.lib
 . /usr/share/univention-lib/all.sh
+. /usr/share/univention-join/joinscripthelper.lib
 
 joinscript_init
 
-eval "$(ucr --shell dump)"
+eval "$(univention-config-registry shell)"
 
 ucs_addServiceToLocalhost "Tine20" "$@"
 
 if [ ! -e /etc/tine20/ldapuser.secret ]; then
     #create a user to use for ldap searches
-    ldappassword=$(makepasswd --minchars=15 --maxchars=20)
-    echo "$ldappassword" > /etc/tine20/ldapuser.secret
+    LDAPPASSWORD=$(makepasswd --minchars=15 --maxchars=20)
+    echo "$LDAPPASSWORD" > /etc/tine20/ldapuser.secret
     chmod 640 /etc/tine20/ldapuser.secret
     chown root:www-data /etc/tine20/ldapuser.secret
 else
-    ldappassword="$(cat /etc/tine20/ldapuser.secret)"
+    LDAPPASSWORD="$(cat /etc/tine20/ldapuser.secret)"
 fi
 
 udm container/cn create "$@" --ignore_exists \
     --position "$ldap_base" \
     --set name=tine20
-                
+
 udm users/user create "$@" --ignore_exists \
     --position "cn=tine20,$ldap_base" \
-    --set username="tine20" --set password="$ldappassword" \
+    --set username="tine20" --set password="$LDAPPASSWORD" \
     --set firstname="Tine 2.0 " --set lastname="LDAP account" \
     --set description="Account used by Tine 2.0 to authenticate against LDAP directory" \
     --option ldap_pwd
 
+# initial setup of Tine 2.0
+
+LDAPHOST="$ldap_server_name\\:$ldap_server_port"
+LDAPBASE=${ldap_base//,/\\\,}
+
+php /usr/share/tine20/setup.php --config=/etc/tine20/config.inc.php --install -- \
+        adminLoginName="administrator" \
+        adminPassword="***" \
+        acceptedTermsVersion=1000 \
+        authentication="backend:ldap,host:$LDAPHOST,username:uid=tine20\,cn=tine20\,$LDAPBASE,password:$LDAPPASSWORD,baseDn:cn=users\,$LDAPBASE,accountFilterFormat:(&(objectClass=posixAccount)(uid=%s))" \
+        accounts="backend:ldap,host:$LDAPHOST,username:uid=tine20\,cn=tine20\,$LDAPBASE,password:$LDAPPASSWORD,userDn:cn=users\,$LDAPBASE,groupsDn:cn=groups\,$LDAPBASE,defaultUserGroupName:Domain Users,defaultAdminGroupName:Domain Admins,readonly:1"
+
+
 joinscript_save_current_version
 
 exit 0
index 0248957..02f9be8 100755 (executable)
 import sys, re
 
 def handler(bc,changes):
-    db_dbname   = bc.get('tine20/cfg/server/mysql_database', 'tine20')
-    db_host     = bc.get('tine20/cfg/server/mysql_host'    , 'localhost')
-    db_username = bc.get('tine20/cfg/server/mysql_user'    , 'tine20')
-    
-    db_password_file = bc.get('tine20/cfg/server/mysql_password', '@&@/etc/tine20/mysql.secret@&@').replace('@&@','')
-    try:
-        db_password = open(db_password_file,'r').readline().strip()
-    except IOError, e:
-        db_password = None
+    db_dbname   = bc.get('tine20/cfg/sql/database', 'tine20')
+    db_host     = bc.get('tine20/cfg/sql/host'    , 'localhost')
+    db_username = bc.get('tine20/cfg/sql/user'    , 'tine20')
     
     try:
         f = open('/etc/tine20/config.inc.php', 'r')
@@ -68,9 +62,6 @@ def handler(bc,changes):
                 if re.search('.*username.*=>', line):
                     line = '        \'username\'      => \'%s\',\n' % str(db_username)
         
-                if re.search('.*password.*=>', line) and db_password:
-                    line = '        \'password\'      => \'%s\',\n' % str(db_password)
-        
                 newlines.append(line)
                 line = f.readline()
                 
index 13049c5..855623a 100644 (file)
@@ -16,6 +16,12 @@ tine20 (2013.10.1~beta2-0) natty; urgency=low
 
  -- Philipp Schüle <p.schuele@metaways.de>  Thu, 02 Oct 2013 11:10:22 +0200
 
+tine20 (2013.10.1~beta1-0) natty; urgency=low
+
+  * New upstream release "Collin" Beta 1
+
+ -- Philipp Schüle <p.schuele@metaways.de>  Thu, 26 Sep 2013 13:41:22 +0200
+
 tine20 (2013.03.8-0) natty; urgency=low
 
   * New upstream release "Kristina" Service Release 7
@@ -52,6 +58,12 @@ tine20 (2013.03.3-0) natty; urgency=low
 
  -- Philipp Schüle <p.schuele@metaways.de>  Thu, 25 Apr 2013 11:30:21 +0200
 
+tine20 (2013.03.2-0) natty; urgency=low
+
+  * New upstream release "Kristina" Service Release 1
+
+ -- Cornelius Weiß <c.weiss@metaways.de>  Thu, 28 Mar 2013 15:30:00 +0100
+
 tine20 (2013.03.1-0) natty; urgency=low
 
   * New upstream release "Kristina"
@@ -68,23 +80,23 @@ tine20 (2013.03.1~beta1-0) natty; urgency=low
 
   * New beta upstream release of "Kristina"
 
- -- Philipp Schüle <p.schuele@metaways.de>  Thu, 14 Feb 2013 11:50:19 +0100
+ -- Philipp Schüle <p.schuele@metaways.de>  Thu, 14 Feb 2013 11:49:18 +0100
 
 tine20 (2013.03.1~alpha1-0) natty; urgency=low
 
   * New alpha upstream release of "Kristina"
 
  -- Philipp Schüle <p.schuele@metaways.de>  Thu, 07 Feb 2013 11:31:17 +0100
-
 tine20 (2012.10.3-0) natty; urgency=low
 
-  * New upstream release Joey SR 3 (2012.10.3) 
+  * New upstream release Joey SR 3 (2012.10.3)
 
- -- Philipp Schüle <p.schuele@metaways.de>  Fri, 04 Jan 2013 15:16:22 +0200
+ -- Philipp Schüle <p.schuele@metaways.de>  Wed, 16 Jan 2013 10:36:23 +0100
 
 tine20 (2012.10.2-0) natty; urgency=low
 
-  * New upstream release Joey SR 1 (2012.10.2) 
+  * New upstream release Joey SR 2 (2012.10.2) 
 
  -- Philipp Schüle <p.schuele@metaways.de>  Thu, 22 Nov 2012 15:16:22 +0200
 
index c069bda..8c92687 100644 (file)
@@ -27,7 +27,10 @@ Description: Tine 2.0 integration package for Univention Corporate Server
 Package: tine20-ucs-udm
 Architecture: all
 Depends: ${misc:Depends}, 
- php5-ldap
+ php5-ldap,
+ univention-postgresql,
+ shell-univention-lib,
+ python-univention-lib
 Description: Tine 2.0 integration package for Univention Corporate Server
  Integration package for installation and configuration of the Tine 2.0
  groupware solution on Univention Corporate Server.
@@ -36,7 +39,7 @@ Package: tine20
 Architecture: all
 Depends: ${misc:Depends}, 
  tine20-webstack (= ${binary:Version}),
- mysql-server
+ postgresql (>= 8.4)
 Description: webbased groupware and crm - metapackage
  Tine 2.0 is an open source project which combines groupware and CRM in one
  consistent interface. Tine 2.0 is web-based and optimises collaboration and
@@ -63,12 +66,13 @@ Depends: ${misc:Depends},
  wwwconfig-common, 
  apache2 | lighttpd | nginx,
  libapache2-mod-php5 | php5-fpm, 
- php5-mysql | php5-mysqli, 
+ php5-pgsql,
  php5-mcrypt, 
  php5-gd,
- php-apc,
+ php5-intl,
+ php5-json,
  makepasswd
-Recommends: mysql-client 
+Recommends: postgresql-client (>= 8.4), php-apc | php5-apc
 Description: Tine 2.0 webserver integration package
  This package integrates Tine 2.0 with the webserver, by installing all needed
  dependencies to make Tine 2.0 available via HTTP(S).
@@ -83,9 +87,10 @@ Description: Additional libraries needed by Tine 2.0
 
 Package: tine20-tinebase
 Architecture: all
-Depends: ${misc:Depends}, 
+Depends: ${misc:Depends},
  tine20-libraries (= ${binary:Version}),
  makepasswd,
+ bsdutils,
  php5-cli
 Recommends: php5-ldap
 Description: webbased groupware and crm - core + addressbook module
@@ -172,3 +177,17 @@ Depends: tine20-tinebase (= ${binary:Version}), tine20-sales (= ${binary:Version
 Description: webbased groupware and crm - humanresources module
  This package contains the humanresources module of Tine 2.0. Installing this package
  enables you to manage personal data about your employees. 
+
+Package: tine20-worker
+Architecture: all
+Depends: ${tine20:Modules},
+ tine20-libraries (= ${binary:Version}),
+ php5-pgsql,
+ php5-mcrypt, 
+ php5-gd,
+ php5-cli,
+ php5-redis (>= 2.2.2)
+Recommends: php-apc | php5-apc
+Description: webbased groupware and crm - asynchronous worker
+ This package contains the asynchronous worker of Tine 2.0. Install this package
+ if you have a high number of users.
index 733fa3c..2fffcde 100644 (file)
@@ -58,6 +58,7 @@ Alias /Microsoft-Server-ActiveSync /usr/share/tine20/Microsoft-Server-ActiveSync
         RewriteRule ^calendars                   index.php?frontend=webdav             [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
         RewriteRule ^webdav                      index.php?frontend=webdav             [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
         RewriteRule ^principals                  index.php?frontend=webdav             [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
+        RewriteRule ^remote.php                  index.php?frontend=webdav             [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
     </IfModule>
 
     <IfModule mod_expires.c>
index 21bb5aa..9bfecc3 100644 (file)
@@ -18,4 +18,5 @@ url.rewrite-once = (
     "^/tine20/calendars\??(.*)$"            => "/tine20/index.php?frontend=webdav&$1",
     "^/tine20/webdav\??(.*)$"               => "/tine20/index.php?frontend=webdav&$1",
     "^/tine20/principals\??(.*)$"           => "/tine20/index.php?frontend=webdav&$1"
+    "^/tine20/remote\.php\??(.*)$"          => "/tine20/index.php?frontend=webdav&$1"
 )
index 119429d..089b706 100644 (file)
@@ -1,8 +1,8 @@
 --- a/config.inc.php.dist
 +++ b/config.inc.php.dist
-@@ -7,32 +7,29 @@
- // minimal configuration
- return array(
+@@ -9,32 +9,29 @@
+     // set 'count' equal zero to disable captcha, or set to number of invalid logins before request captcha.
+     'captcha' => array('count'=>0), 
      'database' => array(
 -        'host'          => 'ENTER DATABASE HOSTNAME',
 -        'dbname'          => 'ENTER DATABASE NAME',
diff --git a/scripts/packaging/Univention/debian/patches/univention_ldap_settings.diff b/scripts/packaging/Univention/debian/patches/univention_ldap_settings.diff
deleted file mode 100644 (file)
index f2dc19a..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-Index: tine20-2012.03.2/Setup/Controller.php
-===================================================================
---- tine20-2012.03.2.orig/Setup/Controller.php 2012-04-12 23:34:26.000000000 +0200
-+++ tine20-2012.03.2/Setup/Controller.php      2012-04-12 23:35:39.000000000 +0200
-@@ -981,7 +981,20 @@
-     protected function _getAuthProviderData()
-     {
-         $result = Tinebase_Auth::getBackendConfigurationWithDefaults(Setup_Core::get(Setup_Core::CHECKDB));
--        $result['backend'] = (Setup_Core::get(Setup_Core::CHECKDB)) ? Tinebase_Auth::getConfiguredBackend() : Tinebase_Auth::SQL;
-+        
-+        if (file_exists('/etc/tine20/ldapuser.secret') && !Setup_Controller::getInstance()->isInstalled('Tinebase')) {
-+            // force LDAP backend
-+            $result['backend'] = Tinebase_User::LDAP;
-+            
-+            // read default settings via ucr
-+            $ldapBase = shell_exec(escapeshellcmd('/usr/sbin/ucr get ldap/base'));
-+            $result[Tinebase_Auth::LDAP]['host'] = shell_exec(escapeshellcmd('/usr/sbin/ucr get ldap/server/name')) . ':' . shell_exec(escapeshellcmd('/usr/sbin/ucr get ldap/server/port'));
-+            $result[Tinebase_Auth::LDAP]['username'] = "uid=tine20,cn=tine20," . $ldapBase;
-+            $result[Tinebase_Auth::LDAP]['password'] = file_get_contents('/etc/tine20/ldapuser.secret');
-+            $result[Tinebase_Auth::LDAP]['baseDn'] = 'cn=users,'  . $ldapBase;
-+        } else {
-+            $result['backend'] = (Setup_Core::get(Setup_Core::CHECKDB)) ? Tinebase_Auth::getConfiguredBackend() : Tinebase_Auth::SQL;
-+        }
-         return $result;
-     }
-@@ -994,7 +1007,24 @@
-     protected function _getAccountsStorageData()
-     {
-         $result = Tinebase_User::getBackendConfigurationWithDefaults(Setup_Core::get(Setup_Core::CHECKDB));
--        $result['backend'] = (Setup_Core::get(Setup_Core::CHECKDB)) ? Tinebase_User::getConfiguredBackend() : Tinebase_User::SQL;
-+        
-+        if (file_exists('/etc/tine20/ldapuser.secret') && !Setup_Controller::getInstance()->isInstalled('Tinebase')) {
-+            // force LDAP backend
-+            $result['backend'] = Tinebase_User::LDAP;
-+            
-+            // read default settings via ucr
-+            $ldapBase = shell_exec(escapeshellcmd('/usr/sbin/ucr get ldap/base'));
-+            $result[Tinebase_User::LDAP]['host']     = shell_exec(escapeshellcmd('/usr/sbin/ucr get ldap/server/name')) . ':' . shell_exec(escapeshellcmd('/usr/sbin/ucr get ldap/server/port'));
-+            $result[Tinebase_User::LDAP]['username'] = "uid=tine20,cn=tine20," . $ldapBase;
-+            $result[Tinebase_User::LDAP]['password'] = file_get_contents('/etc/tine20/ldapuser.secret');
-+            $result[Tinebase_User::LDAP]['userDn']   = 'cn=users,'  . $ldapBase;
-+            $result[Tinebase_User::LDAP]['groupsDn'] = 'cn=groups,' . $ldapBase;
-+            $result[Tinebase_User::LDAP][Tinebase_User::DEFAULT_USER_GROUP_NAME_KEY]  = 'Domain Users';\r
-+            $result[Tinebase_User::LDAP][Tinebase_User::DEFAULT_ADMIN_GROUP_NAME_KEY] = 'Domain Admins';
-+            $result[Tinebase_User::LDAP]['readonly'] = true;
-+        } else {
-+            $result['backend'] = (Setup_Core::get(Setup_Core::CHECKDB)) ? Tinebase_User::getConfiguredBackend() : Tinebase_User::SQL;
-+        }
-         return $result;
-     }
index ff4d628..a13bcf5 100755 (executable)
@@ -32,7 +32,7 @@
 #export DH_VERBOSE=1
 
 PACKAGES := $(shell dh_listpackages)
-MODULES = $(filter-out ucs ucs-udm webstack courses,$(patsubst tine20-%,%,$(filter tine20-%,$(PACKAGES))))
+MODULES = $(filter-out ucs ucs-udm worker webstack courses,$(patsubst tine20-%,%,$(filter tine20-%,$(PACKAGES))))
 
 %:
        dh  $@
@@ -43,6 +43,7 @@ override_dh_installdeb:
        
        # generate list of available subpackages
        (echo -n "tine20:Modules="; for x in $(MODULES); do echo -n "tine20-$$x (= \$${binary:Version}),"; done; echo "") >> debian/tine20-webstack.substvars
+       (echo -n "tine20:Modules="; for x in $(MODULES); do echo -n "tine20-$$x (= \$${binary:Version}),"; done; echo "") >> debian/tine20-worker.substvars
 
 # overwrite dh_fixperms to execute an additional shell script
 override_dh_fixperms:
index 18ab972..9d17d7e 100644 (file)
@@ -1 +1,3 @@
 library                  /usr/share/tine20
+vendor                   /usr/share/tine20
+
index 69c0e6e..d2cda05 100644 (file)
@@ -1,5 +1,4 @@
-MAILTO=root
 SHELL=/bin/bash
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
-* * * * *      www-data        /usr/bin/php -f /usr/share/tine20/tine20.php -- --config=/etc/tine20/config.inc.php --method=Tinebase.triggerAsyncEvents
+* * * * *      www-data        /usr/bin/php -f /usr/share/tine20/tine20.php -- --config=/etc/tine20/config.inc.php --method=Tinebase.triggerAsyncEvents | logger -p daemon.notice -t "Tine 2.0 scheduler"
index a801282..1f884be 100644 (file)
@@ -8,9 +8,11 @@ LICENSE                  /usr/share/tine20
 PRIVACY                  /usr/share/tine20
 bootstrap.php            /usr/share/tine20
 images                   /usr/share/tine20
+fonts                    /usr/share/tine20
 index.php                /usr/share/tine20
 langHelper.php           /usr/share/tine20
 setup.php                /usr/share/tine20
-styles                   /usr/share/tine20
+status.php               /usr/share/tine20
+themes                   /usr/share/tine20
 tine20.php               /usr/share/tine20
 debian/etc/php5.ini      /etc/tine20
index 36701af..31eae33 100644 (file)
 
 # set ucr default values
 ucr set \
-    tine20/cfg/server/mysql_host?'localhost' \
-    tine20/cfg/server/mysql_port?'3306' \
-    tine20/cfg/server/mysql_user?'tine20' \
-    tine20/cfg/server/mysql_password?'@&@/etc/tine20/mysql.secret@&@' \
-    tine20/cfg/server/mysql_database?'tine20' \
+    tine20/cfg/sql/user?'tine20' \
+    tine20/cfg/sql/host?'localhost' \
+    tine20/cfg/sql/port?'5432' \
+    tine20/cfg/sql/database?'tine20' \
     tine20/cfg/directory/cache?"/var/lib/tine20/cache" \
     tine20/cfg/directory/files?"/var/lib/tine20/files" \
     tine20/cfg/directory/sessions?"/var/lib/tine20/sessions" \
index d6f0559..cb6a33c 100644 (file)
@@ -56,17 +56,30 @@ if [ "$1" = "configure" ]; then
                         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
+                
+                # create Apache 2.x configuration links
+                if [ -d /etc/apache2/conf.d/ ]; then
+                    if [ ! -e /etc/apache2/conf.d/tine20 ]; then
+                        ln -s ../../tine20/apache.conf /etc/apache2/conf.d/tine20
+                    fi
+                    
+                elif [ -d /etc/apache2/conf-available ]; then
+                    if [ ! -e /etc/apache2/conf-available/tine20.conf ]; then
+                        ln -s ../../tine20/apache.conf /etc/apache2/conf-available/tine20.conf
+                    fi
+                    
+                    /usr/sbin/a2enconf tine20
                 fi
                 
+                #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)
+                servers="apache2"
                 restart="$restart $webserver"
             
             fi
index 368ecf1..17c4df4 100644 (file)
@@ -42,7 +42,13 @@ if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
 
     case "$webserver" in
         apache2)
-            rm -f /etc/$webserver/conf.d/tine20
+            if [ -L /etc/$webserver/conf.d/tine20 ]; then
+                rm -f /etc/$webserver/conf.d/tine20
+                
+            elif [ -L /etc/$webserver/conf-available/tine20.conf ]; then
+                /usr/sbin/a2disconf tine20
+                rm -f /etc/$webserver/conf-available/tine20.conf
+            fi
             
             # mark webserver for restart (used by restart.sh)
             restart="$restart $webserver"
index c7cd661..ffef379 100644 (file)
 # /usr/share/common-licenses/AGPL-3; if not, see
 # <http://www.gnu.org/licenses/>.
 
-#DEBHELPER#
+set -e
 
 . /usr/share/debconf/confmodule
 db_version 2.0
 
 if [ "$1" = "configure" ]; then
 
-    # create database if needed
-    mysqlPasswordFile="/etc/tine20/mysql.secret"
-    
-    if [ ! -e "$mysqlPasswordFile" ]; then
-        touch      "$mysqlPasswordFile"
-        chmod 0600 "$mysqlPasswordFile"
-        chown 0:0  "$mysqlPasswordFile"
-        
-        password=$(makepasswd --minchars=15 --maxchars=20)
-        echo "$password" > "$mysqlPasswordFile"
-    
-        mysqlCmd="mysql --defaults-file=/etc/mysql/debian.cnf"
-        
-        echo "CREATE DATABASE IF NOT EXISTS tine20;" | $mysqlCmd
-        echo "GRANT ALL ON tine20.* TO 'tine20'@'localhost' IDENTIFIED BY '$password';" | $mysqlCmd
-    fi
-    
     # create config.inc.php if needed
     tine20ConfigFile="/etc/tine20/config.inc.php"
     
     if [ ! -e "$tine20ConfigFile" ] ; then
-        cp /usr/share/doc/tine20-tinebase/examples/config.inc.php.dist "$tine20ConfigFile"
-        chmod 0640       "$tine20ConfigFile"
-        chown 0:www-data "$tine20ConfigFile"
+        cp /usr/share/doc/tine20-tinebase/examples/config.inc.php.dist $tine20ConfigFile
+        chmod 0660       $tine20ConfigFile
+        chown 0:www-data $tine20ConfigFile
 
-        setupuser="tine20setup"
-        setuppassword=$(makepasswd --minchars=10 --maxchars=15)
-
-        mysqlpassword=$(cat "$mysqlPasswordFile")
+        db_get tine20/setupuser
+        setupUser="$RET"
+        db_reset tine20/setupuser || true
+        
+        db_get tine20/setuppasswd
+        setupPassword="$RET"
+        db_reset tine20/setuppasswd || true
+        
+        sqlPassword=$(makepasswd --minchars=15 --maxchars=20)
+        if [ -z $setupPassword ]; then
+            setupPassword=$(makepasswd --minchars=15 --maxchars=20)
+        fi
         
-        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"
-        sed -i -e "s/_SETUPUSERNAME_/$setupuser/g"     "$tine20ConfigFile"
-        sed -i -e "s/_SETUPPASSWORD_/$setuppassword/g" "$tine20ConfigFile"
+        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_/$sqlPassword/g"      $tine20ConfigFile
+        sed -i -e "s/_SETUPUSERNAME_/$setupUser/g"     $tine20ConfigFile
+        sed -i -e "s/_SETUPPASSWORD_/$setupPassword/g" $tine20ConfigFile
+        
+        if [ -x /usr/bin/mysql -a -e /etc/mysql/debian.cnf ]; then
+            mysqlCmd="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
+            
+            echo "CREATE DATABASE IF NOT EXISTS tine20;" | $mysqlCmd
+            echo "GRANT ALL ON tine20.* TO 'tine20'@'localhost' IDENTIFIED BY '${sqlPassword}';" | $mysqlCmd
+            
+        elif [ -x /usr/bin/psql ]; then
+            su - postgres -c "/usr/bin/createuser --no-createdb --no-createrole --no-superuser tine20"
+            su - postgres -c "/usr/bin/psql -c \"ALTER USER tine20 WITH PASSWORD '${sqlPassword}';\" -d template1"
+            su - postgres -c "/usr/bin/createdb --owner=tine20 --template=template0 --encoding=UTF8 tine20"
+            
+            sed -i -e "s/pdo_mysql/pdo_pgsql/g"        $tine20ConfigFile
+        fi
     fi
     
 fi
 
+#DEBHELPER#
+
 exit 0
\ No newline at end of file
index 55563e1..931e5b8 100644 (file)
 
 if [ "$1" = "purge" ]; then
     
-    if [ -x /usr/bin/mysql ]; then
+    if [ -x /usr/bin/mysql -a -e /etc/mysql/debian.cnf ]; then
         mysqlCmd="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
         
         echo "DROP DATABASE IF EXISTS tine20;" | $mysqlCmd
         echo "REVOKE ALL ON tine20.* FROM 'tine20'@'localhost';" | $mysqlCmd
+        
+    elif [ -x /usr/bin/psql ]; then
+        su - postgres -c "/usr/bin/dropdb   tine20"
+        su - postgres -c "/usr/bin/dropuser tine20"
+        
     fi
 
     rm -f /etc/tine20/config.inc.php
index c3b9dea..ffef379 100644 (file)
@@ -69,8 +69,9 @@ if [ "$1" = "configure" ]; then
             echo "GRANT ALL ON tine20.* TO 'tine20'@'localhost' IDENTIFIED BY '${sqlPassword}';" | $mysqlCmd
             
         elif [ -x /usr/bin/psql ]; then
-            su - postgres -c "psql -q -c \"CREATE USER tine20 WITH PASSWORD '${sqlPassword}'\""             >/dev/null 2>&1
-            su - postgres -c "/usr/bin/createdb --owner=tine20 --template=template0 --encoding=UTF8 tine20" >/dev/null 2>&1
+            su - postgres -c "/usr/bin/createuser --no-createdb --no-createrole --no-superuser tine20"
+            su - postgres -c "/usr/bin/psql -c \"ALTER USER tine20 WITH PASSWORD '${sqlPassword}';\" -d template1"
+            su - postgres -c "/usr/bin/createdb --owner=tine20 --template=template0 --encoding=UTF8 tine20"
             
             sed -i -e "s/pdo_mysql/pdo_pgsql/g"        $tine20ConfigFile
         fi