summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJohannes Graumann <johannes_graumann@web.de>2012-10-15 22:17:06 +0300
committerPaul Klos <kolab@klos2day.nl>2012-10-24 06:30:32 -0400
commitcfc34c5f7fca9b45220c99e0bd6983dc3ea353f3 (patch)
tree19eb221206f1c993b6597d378a7bdd38b303f42c /pykolab
parent1f27afd02cc0022db0c464b3dfcbadf77773da23 (diff)
downloadpykolab-cfc34c5f7fca9b45220c99e0bd6983dc3ea353f3.tar.gz
Debianize service restarts/init script updates;
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/setup/setup_freebusy.py15
-rw-r--r--pykolab/setup/setup_imap.py22
-rw-r--r--pykolab/setup/setup_kolabd.py20
-rw-r--r--pykolab/setup/setup_ldap.py19
-rw-r--r--pykolab/setup/setup_mta.py34
-rw-r--r--pykolab/setup/setup_mysql.py21
-rw-r--r--pykolab/setup/setup_roundcube.py15
-rw-r--r--pykolab/setup/setup_syncroton.py15
-rw-r--r--pykolab/setup/setup_zpush.py17
9 files changed, 137 insertions, 41 deletions
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 b1b76dc..df836c4 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:
@@ -520,8 +531,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."))
+