13 commits - pykolab/setup

Johannes Graumann graumann at kolabsys.com
Mon Oct 15 22:25:10 CEST 2012


 pykolab/setup/setup_freebusy.py  |   15 +++++++-
 pykolab/setup/setup_imap.py      |   31 +++++++++++++++---
 pykolab/setup/setup_kolabd.py    |   20 +++++++++--
 pykolab/setup/setup_ldap.py      |   66 +++++++++++++++++++++++++++++++--------
 pykolab/setup/setup_mta.py       |   62 +++++++++++++++++++++++++++++-------
 pykolab/setup/setup_mysql.py     |   23 +++++++++----
 pykolab/setup/setup_roundcube.py |   34 +++++++++++++-------
 pykolab/setup/setup_syncroton.py |   15 +++++++-
 pykolab/setup/setup_zpush.py     |   17 +++++++---
 9 files changed, 221 insertions(+), 62 deletions(-)

New commits:
commit 98f26ff425ebd635b7262996e09d0e8d689974b6
Author: Johannes Graumann <johannes_graumann at web.de>
Date:   Mon Oct 15 23:19:36 2012 +0300

    Debianize: Provide 'time' required by quick fix for current 389-ds bug prohibiting proper restart (see 46a7fbf2a15f347c5fd1d579a5980d87d1906010);
    
    Bug reported upstream and fixed in 289-ds parent releases >= 1.2.11.15-1 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=689389 ;

diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index 442ca6b..f128456 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -25,6 +25,7 @@ import pwd
 import shutil
 import subprocess
 import tempfile
+import time
 
 import components
 


commit 8624fe67b992c9a1f5d6e9b4c2f88eeaaafc67f0
Author: Johannes Graumann <johannes_graumann at web.de>
Date:   Mon Oct 15 23:02:06 2012 +0300

    Debianize: Check for existence of Debian-specific 'dirsrv' user and use for user/group default if present;

diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index b28ac49..442ca6b 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -21,6 +21,7 @@ import gzip
 import ldap
 import ldap.modlist
 import os
+import pwd
 import shutil
 import subprocess
 import tempfile
@@ -110,14 +111,26 @@ def execute(*args, **kw):
                     """)
             )
 
-        _input['userid'] = utils.ask_question(_("User"), default="nobody")
-        _input['group'] = utils.ask_question(_("Group"), default="nobody")
+	try:
+	    pw = pwd.getpwnam("dirsrv")
+	except:
+	    _input['userid'] = utils.ask_question(_("User"), default="nobody")
+	    _input['group'] = utils.ask_question(_("Group"), default="nobody")
+	else:
+	    _input['userid'] = utils.ask_question(_("User"), default="dirsrv")
+	    _input['group'] = utils.ask_question(_("Group"), default="dirsrv")
 
     else:
         _input['admin_pass'] = conf.get('ldap', 'bind_pw')
         _input['dirmgr_pass'] = conf.get('ldap', 'bind_pw')
-        _input['userid'] = "nobody"
-        _input['group'] = "nobody"
+        try:
+	    pw = pwd.getpwnam("dirsrv")
+	except:
+	    _input['userid'] = "nobody"
+	    _input['group'] = "nobody"
+	else:
+	    _input['userid'] = "dirsrv"
+	    _input['group'] = "dirsrv"
 
     # TODO: Verify the user and group exist.
 


commit 87a93c748fb5b1591a9e26e6cd377e22f54706d0
Author: Johannes Graumann <johannes_graumann at web.de>
Date:   Mon Oct 15 22:41:34 2012 +0300

    Debianize: Adapt to Debians use of roundcube rather than roundcubemail;

diff --git a/pykolab/setup/setup_roundcube.py b/pykolab/setup/setup_roundcube.py
index 4a5b394..e242e04 100644
--- a/pykolab/setup/setup_roundcube.py
+++ b/pykolab/setup/setup_roundcube.py
@@ -119,14 +119,13 @@ def execute(*args, **kw):
 
             t = Template(template_definition, searchList=[rc_settings])
             log.debug(
-                    _("Successfully compiled template %r, writing out to %r") % (
-                            template_file,
-                            '/etc/roundcubemail/%s' % (want_file)
-                        ),
+                    _("Successfully compiled template %r, writing out to %r") % (template_file, want_file),
                     level=8
                 )
-
-            fp = open('/etc/roundcubemail/%s' % (want_file), 'w')
+	    if os.path.isdir('/etc/roundcubemail'):
+	      fp = open('/etc/roundcubemail/%s' % (want_file), 'w')
+	    elif os.path.isdir('/etc/roundcube'):
+	      fp = open('/etc/roundcube/%s' % (want_file), 'w')
             fp.write(t.__str__())
             fp.close()
 
@@ -143,14 +142,18 @@ def execute(*args, **kw):
                 if not schema_filepath in schema_files:
                     schema_files.append(schema_filepath)
 
-    for root, directories, filenames in os.walk('/usr/share/roundcubemail/plugins/calendar/drivers/kolab/'):
+    if os.path.isdir('/usr/share/roundcubemail'):
+	rcpath = '/usr/share/roundcubemail/'
+    elif os.path.isdir('/usr/share/roundcube'):
+	rcpath = '/usr/share/roundcube/'
+    for root, directories, filenames in os.walk(rcpath + 'plugins/calendar/drivers/kolab/'):
         for filename in filenames:
             if filename.startswith('mysql') and filename.endswith('.sql'):
                 schema_filepath = os.path.join(root,filename)
                 if not schema_filepath in schema_files:
                     schema_files.append(schema_filepath)
 
-    for root, directories, filenames in os.walk('/usr/share/roundcubemail/plugins/libkolab/'):
+    for root, directories, filenames in os.walk(rcpath + 'plugins/libkolab/'):
         for filename in filenames:
             if filename.startswith('mysql') and filename.endswith('.sql'):
                 schema_filepath = os.path.join(root,filename)


commit 9f4d66dfe7a0eb9e059433372d3b3b8ebfc55155
Author: Johannes Graumann <johannes_graumann at web.de>
Date:   Mon Oct 15 22:37:55 2012 +0300

    Clarify otherwise redundant warning message;

diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py
index e4940a0..9c73047 100644
--- a/pykolab/setup/setup_mysql.py
+++ b/pykolab/setup/setup_mysql.py
@@ -135,5 +135,5 @@ password='%s'
 
         conf.command_set('kolab_wap', 'sql_uri', 'mysql://kolab:%s@localhost/kolab' % (mysql_kolab_password))
     else:
-        log.warning(_("Could not find the Kolab schema file"))
+        log.warning(_("Could not find the MySQL Kolab schema file"))
 


commit a2486764ecca3a6203d2ba6dfabeff66c95a9e58
Author: Johannes Graumann <johannes_graumann at web.de>
Date:   Mon Oct 15 22:36:41 2012 +0300

    Debianize: Edit /etc/default/spamassassin to allow for init script mediated startup;

diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index 9c7c200..b841621 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -312,6 +312,14 @@ result_attribute = mail
         f.writelines(conf.get('kolab', 'primary_domain'))
         f.close()	
 
+    if os.path.isfile('/etc/default/spamassassin'):
+	myaugeas = Augeas()
+	setting = os.path.join('/files/etc/default/spamassassin','ENABLED')
+	if not myaugeas.get(setting) == '1':
+	  myaugeas.set(setting,'1')
+	  myaugeas.save()
+	myaugeas.close()
+        
     if os.path.isfile('/bin/systemctl'):
         subprocess.call(['systemctl', 'restart', 'postfix.service'])
         subprocess.call(['systemctl', 'restart', 'amavisd.service'])


commit a01d23ee133c90565f7ef0a49f41970ccc7efa75
Author: Johannes Graumann <johannes_graumann at web.de>
Date:   Mon Oct 15 22:35:45 2012 +0300

    Debianize: Provide amavisd-requested /etc/mailname - possibly remediable through enhancement filed as #1080?

diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index 5b4b97e..9c7c200 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -306,6 +306,11 @@ result_attribute = mail
     # while really it isn't required.
     else:
         log.info(_("Not writing out any configuration for Amavis."))
+	# On debian wheezy amavisd-new expects '/etc/mailname' - possibly remediable through 
+	# the #1080 enhancement mentioned above, but here's a quick fix.
+	f = open('/etc/mailname','w')
+        f.writelines(conf.get('kolab', 'primary_domain'))
+        f.close()	
 
     if os.path.isfile('/bin/systemctl'):
         subprocess.call(['systemctl', 'restart', 'postfix.service'])


commit 728ca8f9910761474ec7ad4fedd6e5793040596c
Author: Johannes Graumann <johannes_graumann at web.de>
Date:   Mon Oct 15 22:34:14 2012 +0300

    Debianize: Conditionally adapt amavisd configuration path;

diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index 6a5c691..5b4b97e 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -289,7 +289,10 @@ result_attribute = mail
             fp.close()
 
             t = Template(template_definition, searchList=[amavisd_settings])
-            fp = open('/etc/amavisd/amavisd.conf', 'w')
+        if os.path.isdir('/etc/amavisd'):
+	    fp = open('/etc/amavisd/amavisd.conf', 'w')
+	elif os.path.isdir('/etc/amavis'):
+	    fp = open('/etc/amavis/amavisd.conf', 'w')
             fp.write(t.__str__())
             fp.close()
 


commit 45c0bac1d190b6492c2dba5586cee6608cf2bf15
Author: Johannes Graumann <johannes_graumann at web.de>
Date:   Mon Oct 15 22:33:09 2012 +0300

    Debianize: Provide main.cf from Debian's example file if user choose not to debconf-configure postfix during installation;

diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index 09f6d06..6a5c691 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -20,6 +20,7 @@
 from augeas import Augeas
 from Cheetah.Template import Template
 import os
+import shutil
 import subprocess
 
 import components
@@ -208,6 +209,13 @@ result_attribute = mail
 
         }
 
+    if not os.path.isfile('/etc/postfix/main.cf'):
+      if os.path.isfile('/usr/share/postfix/main.cf.debian'):
+	shutil.copy(
+	    '/usr/share/postfix/main.cf.debian',
+	    '/etc/postfix/main.cf'
+	)
+        
     myaugeas = Augeas()
 
     setting_base = '/files/etc/postfix/main.cf/'


commit cc0c41beccb06fe7de7111affb96e3f0194ac839
Author: Johannes Graumann <johannes_graumann at web.de>
Date:   Mon Oct 15 22:29:10 2012 +0300

    Debianize: Adapt setup-ds* paths;

diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index 4f91dd2..b28ac49 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -223,11 +223,15 @@ ServerAdminPwd = %(admin_pass)s
     os.write(fp, data)
     os.close(fp)
 
-    setup_ds_admin = "/usr/sbin/setup-ds-admin.pl"
-
-    if not os.path.isfile(setup_ds_admin):
-        setup_ds_admin = "/usr/sbin/setup-ds-admin"
-
+    if os.path.isfile("/usr/sbin/setup-ds-admin.pl"):
+	setup_ds_admin = "/usr/sbin/setup-ds-admin.pl"
+#    elif os.path.isfile("/usr/sbin/setup-ds-admin"):
+#	setup_ds_admin = "/usr/sbin/setup-ds-admin"
+    elif os.path.isfile("/usr/sbin/setup-ds"):
+	setup_ds_admin = "/usr/sbin/setup-ds"
+    else:
+	log.error(_("No directory server setup tool available."))
+    
     command = [
             setup_ds_admin,
             '--debug',


commit e9ef1e603f007600868953d912c509dc35be4bba
Author: Johannes Graumann <johannes_graumann at web.de>
Date:   Mon Oct 15 22:27:24 2012 +0300

    Debianize: Enable dealing with compressed 'kolab2.ldif.gz';

diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index 270c6be..4f91dd2 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -17,6 +17,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
 
+import gzip
 import ldap
 import ldap.modlist
 import os
@@ -272,6 +273,14 @@ ServerAdminPwd = %(admin_pass)s
         for filename in filenames:
             if filename == 'kolab2.ldif':
                 schema_file = os.path.join(root,filename)
+            if filename == 'kolab2.ldif.gz':
+		f = gzip.open(os.path.join(root,filename), 'rb')
+		file_content = f.read()
+		f.close()
+		(nf, tmp_schema_file) = tempfile.mkstemp(dir="/tmp/")
+		nf.writelines(file_content)
+		nf.close()
+		schema_file = tmp_schema_file
 
     if not schema_file == None:
         shutil.copy(


commit 783c4605566715de2cc2fe280d4d0ab3c56b5043
Author: Johannes Graumann <johannes_graumann at web.de>
Date:   Mon Oct 15 22:25:26 2012 +0300

    Clarify otherwise redundant warning message;

diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index 6e1be70..270c6be 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -281,7 +281,7 @@ ServerAdminPwd = %(admin_pass)s
                     )
             )
     else:
-        log.warning(_("Could not find the Kolab schema file"))
+        log.warning(_("Could not find the ldap Kolab schema file"))
 
     if os.path.isfile('/bin/systemctl'):
         subprocess.call(['/bin/systemctl', 'restart', 'dirsrv.target'])


commit 43813aa60a0269e70de9a65041dc0bfb01c3b37a
Author: Johannes Graumann <johannes_graumann at web.de>
Date:   Mon Oct 15 22:20:06 2012 +0300

    Debianize: Edit /etc/default/kolab-saslauthd to allow for init script mediated startup;

diff --git a/pykolab/setup/setup_imap.py b/pykolab/setup/setup_imap.py
index 7ad9966..bd33a5b 100644
--- a/pykolab/setup/setup_imap.py
+++ b/pykolab/setup/setup_imap.py
@@ -17,6 +17,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
 
+from augeas import Augeas
 from Cheetah.Template import Template
 import os
 import subprocess
@@ -129,6 +130,14 @@ def execute(*args, **kw):
     fp.write("\n".join(annotations))
     fp.close()
 
+    if os.path.isfile('/etc/default/kolab-saslauthd'):
+	myaugeas = Augeas()
+	setting = os.path.join('/files/etc/default/kolab-saslauthd','START')
+	if not myaugeas.get(setting) == 'yes':
+	  myaugeas.set(setting,'yes')
+	  myaugeas.save()
+	myaugeas.close()
+    
     if os.path.isfile('/bin/systemctl'):
         subprocess.call(['systemctl', 'restart', 'cyrus-imapd.service'])
         subprocess.call(['systemctl', 'restart', 'kolab-saslauthd.service'])


commit 46a7fbf2a15f347c5fd1d579a5980d87d1906010
Author: Johannes Graumann <johannes_graumann at web.de>
Date:   Mon Oct 15 22:17:06 2012 +0300

    Debianize service restarts/init script updates;

diff --git a/pykolab/setup/setup_freebusy.py b/pykolab/setup/setup_freebusy.py
index 22c74c4..7fe7d5f 100644
--- a/pykolab/setup/setup_freebusy.py
+++ b/pykolab/setup/setup_freebusy.py
@@ -111,11 +111,20 @@ def execute(*args, **kw):
 
     if os.path.isfile('/bin/systemctl'):
         subprocess.call(['/bin/systemctl', 'restart', 'httpd.service'])
-        subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
     elif os.path.isfile('/sbin/service'):
         subprocess.call(['/sbin/service', 'httpd', 'restart'])
+    elif os.path.isfile('/usr/sbin/service'):
+	subprocess.call(['/usr/sbin/service','apache2','restart'])
+    else:
+        log.error(_("Could not start the webserver server service."))
+
+    if os.path.isfile('/bin/systemctl'):
+        subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
+    elif os.path.isfile('/sbin/chkconfig'):
         subprocess.call(['/sbin/chkconfig', 'httpd', 'on'])
+    elif os.path.isfile('/usr/sbin/update-rc.d'):
+        subprocess.call(['/usr/sbin/update-rc.d', 'apache2', 'defaults'])
     else:
-        log.error(_("Could not start and configure to start on boot, the " + \
-                "webserver service."))
+        log.error(_("Could not configure to start on boot, the " + \
+                "webserver server service."))
 
diff --git a/pykolab/setup/setup_imap.py b/pykolab/setup/setup_imap.py
index 750e43d..7ad9966 100644
--- a/pykolab/setup/setup_imap.py
+++ b/pykolab/setup/setup_imap.py
@@ -131,14 +131,26 @@ def execute(*args, **kw):
 
     if os.path.isfile('/bin/systemctl'):
         subprocess.call(['systemctl', 'restart', 'cyrus-imapd.service'])
-        subprocess.call(['systemctl', 'enable', 'cyrus-imapd.service'])
         subprocess.call(['systemctl', 'restart', 'kolab-saslauthd.service'])
-        subprocess.call(['systemctl', 'enable', 'kolab-saslauthd.service'])
     elif os.path.isfile('/sbin/service'):
         subprocess.call(['service', 'cyrus-imapd', 'restart'])
-        subprocess.call(['chkconfig', 'cyrus-imapd', 'on'])
         subprocess.call(['service', 'kolab-saslauthd', 'restart'])
+    elif os.path.isfile('/usr/sbin/service'):
+	subprocess.call(['/usr/sbin/service','cyrus-imapd','restart'])
+	subprocess.call(['/usr/sbin/service','kolab-saslauthd','restart'])
+    else:
+        log.error(_("Could not start the cyrus-imapd and kolab-saslauthd services."))
+
+    if os.path.isfile('/bin/systemctl'):
+        subprocess.call(['systemctl', 'enable', 'cyrus-imapd.service'])
+        subprocess.call(['systemctl', 'enable', 'kolab-saslauthd.service'])
+    elif os.path.isfile('/sbin/chkconfig'):
+        subprocess.call(['chkconfig', 'cyrus-imapd', 'on'])
         subprocess.call(['chkconfig', 'kolab-saslauthd', 'on'])
+    elif os.path.isfile('/usr/sbin/update-rc.d'):
+        subprocess.call(['/usr/sbin/update-rc.d', 'cyrus-imapd', 'defaults'])
+        subprocess.call(['/usr/sbin/update-rc.d', 'kolab-saslauthd', 'defaults'])
+        subprocess.call(['/usr/sbin/update-rc.d', 'saslauthd', 'disable'])
     else:
-        log.error(_("Could not start and configure to start on boot, the " + \
-                "cyrus-imapd and kolab-saslauthd services."))
+        log.error(_("Could not configure to start on boot, the " + \
+                "cyrus-imapd and kolab-saslauthd services."))            
diff --git a/pykolab/setup/setup_kolabd.py b/pykolab/setup/setup_kolabd.py
index 9e35a85..df05043 100644
--- a/pykolab/setup/setup_kolabd.py
+++ b/pykolab/setup/setup_kolabd.py
@@ -63,8 +63,20 @@ def execute(*args, **kw):
             fp.close()
 
     if os.path.isfile('/bin/systemctl'):
-        subprocess.call(['systemctl', 'restart', 'kolabd.service'])
-        subprocess.call(['systemctl', 'enable', 'kolabd.service'])
+        subprocess.call(['/bin/systemctl', 'restart', 'kolabd.service'])
     elif os.path.isfile('/sbin/service'):
-        subprocess.call(['service', 'kolabd', 'restart'])
-        subprocess.call(['chkconfig', 'kolabd', 'on'])
+        subprocess.call(['/sbin/service', 'kolabd', 'restart'])
+    elif os.path.isfile('/usr/sbin/service'):
+	subprocess.call(['/usr/sbin/service','kolab-server','restart'])
+    else:
+        log.error(_("Could not start the kolab server service."))
+
+    if os.path.isfile('/bin/systemctl'):
+        subprocess.call(['/bin/systemctl', 'enable', 'kolabd.service'])
+    elif os.path.isfile('/sbin/chkconfig'):
+        subprocess.call(['/sbin/chkconfig', 'kolabd', 'on'])
+    elif os.path.isfile('/usr/sbin/update-rc.d'):
+        subprocess.call(['/usr/sbin/update-rc.d', 'kolab-server', 'defaults'])
+    else:
+        log.error(_("Could not configure to start on boot, the " + \
+                "kolab server service."))
diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index 93c9d04..6e1be70 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -285,12 +285,23 @@ ServerAdminPwd = %(admin_pass)s
 
     if os.path.isfile('/bin/systemctl'):
         subprocess.call(['/bin/systemctl', 'restart', 'dirsrv.target'])
-        subprocess.call(['/bin/systemctl', 'enable', 'dirsrv.target'])
     elif os.path.isfile('/sbin/service'):
         subprocess.call(['/sbin/service', 'dirsrv', 'restart'])
+    elif os.path.isfile('/usr/sbin/service'):
+	subprocess.call(['/usr/sbin/service','dirsrv','stop'])
+	time.sleep(20)
+	subprocess.call(['/usr/sbin/service','dirsrv','start'])
+    else:
+        log.error(_("Could not start the directory server service."))
+
+    if os.path.isfile('/bin/systemctl'):
+        subprocess.call(['/bin/systemctl', 'enable', 'dirsrv.target'])
+    elif os.path.isfile('/sbin/chkconfig'):
         subprocess.call(['/sbin/chkconfig', 'dirsrv', 'on'])
+    elif os.path.isfile('/usr/sbin/update-rc.d'):
+        subprocess.call(['/usr/sbin/update-rc.d', 'dirsrv', 'defaults'])
     else:
-        log.error(_("Could not start and configure to start on boot, the " + \
+        log.error(_("Could not configure to start on boot, the " + \
                 "directory server service."))
 
     if ask_questions:
@@ -525,8 +536,10 @@ ServerAdminPwd = %(admin_pass)s
 
     if os.path.isfile('/bin/systemctl'):
         subprocess.call(['/bin/systemctl', 'enable', 'dirsrv-admin.service'])
-    elif os.path.isfile('/sbin/service'):
+    elif os.path.isfile('/sbin/chkconfig'):
         subprocess.call(['/sbin/chkconfig', 'dirsrv-admin', 'on'])
+    elif os.path.isfile('/usr/sbin/update-rc.d'):
+        subprocess.call(['/usr/sbin/update-rc.d', 'dirsrv-admin', 'defaults'])
     else:
         log.error(_("Could not start and configure to start on boot, the " + \
                 "directory server admin service."))
diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index e6a019c..09f6d06 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -298,23 +298,37 @@ result_attribute = mail
 
     if os.path.isfile('/bin/systemctl'):
         subprocess.call(['systemctl', 'restart', 'postfix.service'])
-        subprocess.call(['systemctl', 'enable', 'postfix.service'])
         subprocess.call(['systemctl', 'restart', 'amavisd.service'])
-        subprocess.call(['systemctl', 'enable', 'amavisd.service'])
         subprocess.call(['systemctl', 'restart', 'clamd.amavisd.service'])
-        subprocess.call(['systemctl', 'enable', 'clamd.amavisd.service'])
         subprocess.call(['systemctl', 'restart', 'wallace.service'])
-        subprocess.call(['systemctl', 'enable', 'wallace.service'])
     elif os.path.isfile('/sbin/service'):
         subprocess.call(['service', 'postfix', 'restart'])
-        subprocess.call(['chkconfig', 'postfix', 'on'])
         subprocess.call(['service', 'amavisd', 'restart'])
-        subprocess.call(['chkconfig', 'amavisd', 'on'])
         subprocess.call(['service', 'clamd.amavisd', 'restart'])
-        subprocess.call(['chkconfig', 'clamd.amavisd', 'on'])
         subprocess.call(['service', 'wallace', 'restart'])
-        subprocess.call(['chkconfig', 'wallace', 'on'])
+    elif os.path.isfile('/usr/sbin/service'):
+	subprocess.call(['/usr/sbin/service','postfix','restart'])
+	subprocess.call(['/usr/sbin/service','amavis','restart'])
+	subprocess.call(['/usr/sbin/service','clamav-daemon','restart'])
+	subprocess.call(['/usr/sbin/service','wallace','restart'])
     else:
-        log.error(_("Could not start and configure to start on boot, the " + \
-                "postfix, clamav.amavisd and amavisd services."))
+        log.error(_("Could not start the postfix, clamav and amavisd services services."))
 
+    if os.path.isfile('/bin/systemctl'):
+        subprocess.call(['systemctl', 'enable', 'postfix.service'])
+        subprocess.call(['systemctl', 'enable', 'amavisd.service'])
+        subprocess.call(['systemctl', 'enable', 'clamd.amavisd.service'])
+        subprocess.call(['systemctl', 'enable', 'wallace.service'])
+    elif os.path.isfile('/sbin/chkconfig'):
+        subprocess.call(['chkconfig', 'postfix', 'on'])
+        subprocess.call(['chkconfig', 'amavisd', 'on'])
+        subprocess.call(['chkconfig', 'clamd.amavisd', 'on'])
+        subprocess.call(['chkconfig', 'wallace', 'on'])
+    elif os.path.isfile('/usr/sbin/update-rc.d'):
+        subprocess.call(['/usr/sbin/update-rc.d', 'postfix', 'defaults'])
+        subprocess.call(['/usr/sbin/update-rc.d', 'amavis', 'defaults'])
+        subprocess.call(['/usr/sbin/update-rc.d', 'clamav-daemon', 'defaults'])
+        subprocess.call(['/usr/sbin/update-rc.d', 'wallace', 'defaults'])
+    else:
+        log.error(_("Could not configure to start on boot, the " + \
+                "postfix, clamav and amavisd services."))
diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py
index 093d187..e4940a0 100644
--- a/pykolab/setup/setup_mysql.py
+++ b/pykolab/setup/setup_mysql.py
@@ -40,15 +40,24 @@ def description():
 
 def execute(*args, **kw):
     if os.path.isfile('/bin/systemctl'):
-        subprocess.call(['/bin/systemctl', 'start', 'mysqld.service'])
-        subprocess.call(['/bin/systemctl', 'enable', 'mysqld.service'])
+        subprocess.call(['/bin/systemctl', 'restart', 'mysqld.service'])
     elif os.path.isfile('/sbin/service'):
-        subprocess.call(['/sbin/service', 'mysqld', 'start'])
-        subprocess.call(['/sbin/chkconfig', 'mysqld', 'on'])
+        subprocess.call(['/sbin/service', 'mysqld', 'restart'])
+    elif os.path.isfile('/usr/sbin/service'):
+	subprocess.call(['/usr/sbin/service','mysql','restart'])
     else:
-        log.error(_("Could not start and configure to start on boot, the " + \
-                "MySQL database service."))
+        log.error(_("Could not start the MySQL database service."))
 
+    if os.path.isfile('/bin/systemctl'):
+        subprocess.call(['/bin/systemctl', 'enable', 'mysqld.service'])
+    elif os.path.isfile('/sbin/chkconfig'):
+        subprocess.call(['/sbin/chkconfig', 'mysqld', 'on'])
+    elif os.path.isfile('/usr/sbin/update-rc.d'):
+        subprocess.call(['/usr/sbin/update-rc.d', 'mysql', 'defaults'])
+    else:
+        log.error(_("Could not configure to start on boot, the " + \
+                "MySQL database service."))                
+                
     print >> sys.stderr, utils.multiline_message(
             _("""
                     Please supply a root password for MySQL. This password will
diff --git a/pykolab/setup/setup_roundcube.py b/pykolab/setup/setup_roundcube.py
index 0f45711..4a5b394 100644
--- a/pykolab/setup/setup_roundcube.py
+++ b/pykolab/setup/setup_roundcube.py
@@ -182,11 +182,20 @@ def execute(*args, **kw):
 
     if os.path.isfile('/bin/systemctl'):
         subprocess.call(['/bin/systemctl', 'restart', 'httpd.service'])
-        subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
     elif os.path.isfile('/sbin/service'):
         subprocess.call(['/sbin/service', 'httpd', 'restart'])
+    elif os.path.isfile('/usr/sbin/service'):
+	subprocess.call(['/usr/sbin/service','apache2','restart'])
+    else:
+        log.error(_("Could not start the webserver server service."))
+
+    if os.path.isfile('/bin/systemctl'):
+        subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
+    elif os.path.isfile('/sbin/chkconfig'):
         subprocess.call(['/sbin/chkconfig', 'httpd', 'on'])
+    elif os.path.isfile('/usr/sbin/update-rc.d'):
+        subprocess.call(['/usr/sbin/update-rc.d', 'apache2', 'defaults'])
     else:
-        log.error(_("Could not start and configure to start on boot, the " + \
-                "webserver service."))
+        log.error(_("Could not configure to start on boot, the " + \
+                "webserver server service."))
 
diff --git a/pykolab/setup/setup_syncroton.py b/pykolab/setup/setup_syncroton.py
index 8298db5..46d5190 100644
--- a/pykolab/setup/setup_syncroton.py
+++ b/pykolab/setup/setup_syncroton.py
@@ -58,11 +58,20 @@ def execute(*args, **kw):
 
     if os.path.isfile('/bin/systemctl'):
         subprocess.call(['/bin/systemctl', 'restart', 'httpd.service'])
-        subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
     elif os.path.isfile('/sbin/service'):
         subprocess.call(['/sbin/service', 'httpd', 'restart'])
+    elif os.path.isfile('/usr/sbin/service'):
+	subprocess.call(['/usr/sbin/service','apache2','restart'])
+    else:
+        log.error(_("Could not start the webserver server service."))
+
+    if os.path.isfile('/bin/systemctl'):
+        subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
+    elif os.path.isfile('/sbin/chkconfig'):
         subprocess.call(['/sbin/chkconfig', 'httpd', 'on'])
+    elif os.path.isfile('/usr/sbin/update-rc.d'):
+        subprocess.call(['/usr/sbin/update-rc.d', 'apache2', 'defaults'])
     else:
-        log.error(_("Could not start and configure to start on boot, the " + \
-                "webserver service."))
+        log.error(_("Could not configure to start on boot, the " + \
+                "webserver server service."))
 
diff --git a/pykolab/setup/setup_zpush.py b/pykolab/setup/setup_zpush.py
index 3aa7a0b..b1ba921 100644
--- a/pykolab/setup/setup_zpush.py
+++ b/pykolab/setup/setup_zpush.py
@@ -90,11 +90,20 @@ def execute(*args, **kw):
 
     if os.path.isfile('/bin/systemctl'):
         subprocess.call(['/bin/systemctl', 'restart', 'httpd.service'])
-        subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
     elif os.path.isfile('/sbin/service'):
         subprocess.call(['/sbin/service', 'httpd', 'restart'])
-        subprocess.call(['/sbin/chkconfig', 'httpd', 'on'])
+    elif os.path.isfile('/usr/sbin/service'):
+	subprocess.call(['/usr/sbin/service','apache2','restart'])
     else:
-        log.error(_("Could not start and configure to start on boot, the " + \
-                "webserver service."))
+        log.error(_("Could not start the webserver server service."))
 
+    if os.path.isfile('/bin/systemctl'):
+        subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
+    elif os.path.isfile('/sbin/chkconfig'):
+        subprocess.call(['/sbin/chkconfig', 'httpd', 'on'])
+    elif os.path.isfile('/usr/sbin/update-rc.d'):
+        subprocess.call(['/usr/sbin/update-rc.d', 'apache2', 'defaults'])
+    else:
+        log.error(_("Could not configure to start on boot, the " + \
+                "webserver server service."))
+ 





More information about the commits mailing list