[PATCH 10/16] Debianize service maintenance script path ("/usr/sbin/service"), start sequence-integration tool ("/usr/sbin/update-rc.d");

Johannes Graumann johannes_graumann at web.de
Mon Oct 1 19:10:42 CEST 2012


---
 pykolab/setup/setup_imap.py |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/pykolab/setup/setup_imap.py b/pykolab/setup/setup_imap.py
index 750e43d..f3c3172 100644
--- a/pykolab/setup/setup_imap.py
+++ b/pykolab/setup/setup_imap.py
@@ -131,14 +131,25 @@ 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'])
     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."))            
\ No newline at end of file
-- 
1.7.10.4




More information about the devel mailing list