summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAeneas Jai├čle <aj@ajaissle.de>2015-12-08 12:26:27 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2015-12-08 12:26:27 +0100
commit1be9c02b5cd47a4a6eb2442e86412a4549d9c645 (patch)
treef6c76f28e425bfee60df733469a39bc31f541343
parentb60425346034d8a0321d54505a32f9401250000c (diff)
downloadpykolab-1be9c02b5cd47a4a6eb2442e86412a4549d9c645.tar.gz
Upstream submission of some universal openSUSE patches
Summary: * setup_mta: fix for not writing to amavisd.conf * setup_roundcube: skins reside in rcpath/skins * setup_mysql: mysql.service in openSUSE * setup_mta: amavis.service and clamd.service in openSUSE * setup_imap: cyrus.service in openSUSE * setup_roundcube: apache2.service also in openSUSE * setup_syncroton: apache2.service also in openSUSE * setup_roundcube: add "www" group Fixes T849 Reviewers: #pykolab_developers, vanmeeuwen Reviewed By: #pykolab_developers, vanmeeuwen Maniphest Tasks: T849 Differential Revision: https://git.kolab.org/D70
-rw-r--r--pykolab/setup/setup_imap.py8
-rw-r--r--pykolab/setup/setup_mta.py36
-rw-r--r--pykolab/setup/setup_mysql.py4
-rw-r--r--pykolab/setup/setup_roundcube.py45
-rw-r--r--pykolab/setup/setup_syncroton.py14
5 files changed, 66 insertions, 41 deletions
diff --git a/pykolab/setup/setup_imap.py b/pykolab/setup/setup_imap.py
index 57b4023..584787c 100644
--- a/pykolab/setup/setup_imap.py
+++ b/pykolab/setup/setup_imap.py
@@ -142,10 +142,14 @@ def execute(*args, **kw):
myaugeas.close()
+ imapservice = 'cyrus-imapd.service'
+ if os.path.isfile('/usr/lib/systemd/system/cyrus.service'):
+ imapservice = 'cyrus.service'
+
if os.path.isfile('/bin/systemctl'):
subprocess.call(['systemctl', 'stop', 'saslauthd.service'])
subprocess.call(['systemctl', 'restart', 'kolab-saslauthd.service'])
- subprocess.call(['systemctl', 'restart', 'cyrus-imapd.service'])
+ subprocess.call(['systemctl', 'restart', imapservice])
elif os.path.isfile('/sbin/service'):
subprocess.call(['service', 'saslauthd', 'stop'])
subprocess.call(['service', 'kolab-saslauthd', 'restart'])
@@ -160,7 +164,7 @@ def execute(*args, **kw):
if os.path.isfile('/bin/systemctl'):
subprocess.call(['systemctl', 'disable', 'saslauthd.service'])
subprocess.call(['systemctl', 'enable', 'kolab-saslauthd.service'])
- subprocess.call(['systemctl', 'enable', 'cyrus-imapd.service'])
+ subprocess.call(['systemctl', 'enable', imapservice])
elif os.path.isfile('/sbin/chkconfig'):
subprocess.call(['chkconfig', 'saslauthd', 'off'])
subprocess.call(['chkconfig', 'kolab-saslauthd', 'on'])
diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index 56109fe..f2883a7 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -369,7 +369,19 @@ result_format = "shared+%%s"
template_file = None
# On RPM installations, Amavis configuration is contained within a single file.
- if os.path.isfile("/etc/amavisd/amavisd.conf"):
+ amavisconf_paths = [
+ "/etc/amavisd.conf",
+ "/etc/amavis/amavisd.conf",
+ "/etc/amavisd/amavisd.conf"
+ ]
+
+ amavis_conf = ''
+ for amavisconf_path in amavisconf_paths:
+ if os.path.isfile(amavisconf_path):
+ amavis_conf = amavisconf_path
+ break
+
+ if os.path.isfile(amavis_conf):
if os.path.isfile('/etc/kolab/templates/amavisd.conf.tpl'):
template_file = '/etc/kolab/templates/amavisd.conf.tpl'
elif os.path.isfile('/usr/share/kolab/templates/amavisd.conf.tpl'):
@@ -391,12 +403,7 @@ result_format = "shared+%%s"
t = Template(template_definition, searchList=[amavisd_settings])
fp = None
- 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')
- elif os.path.isfile('/etc/amavisd.conf'):
- fp = open('/etc/amavisd.conf', 'w')
+ fp = open(amavis_conf, 'w')
if not fp == None:
fp.write(t.__str__())
@@ -435,10 +442,17 @@ result_format = "shared+%%s"
myaugeas.save()
myaugeas.close()
+ amavisservice = 'amavisd.service'
+ clamavservice = 'clamd@amavisd.service'
+ if os.path.isfile('/usr/lib/systemd/system/amavis.service'):
+ amavisservice = 'amavis.service'
+ if os.path.isfile('/usr/lib/systemd/system/clamd.service'):
+ clamavservice = 'clamd.service'
+
if os.path.isfile('/bin/systemctl'):
subprocess.call(['systemctl', 'restart', 'postfix.service'])
- subprocess.call(['systemctl', 'restart', 'amavisd.service'])
- subprocess.call(['systemctl', 'restart', 'clamd@amavisd.service'])
+ subprocess.call(['systemctl', 'restart', amavisservice])
+ subprocess.call(['systemctl', 'restart', clamavservice])
subprocess.call(['systemctl', 'restart', 'wallace.service'])
elif os.path.isfile('/sbin/service'):
subprocess.call(['service', 'postfix', 'restart'])
@@ -455,8 +469,8 @@ result_format = "shared+%%s"
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', amavisservice])
+ subprocess.call(['systemctl', 'enable', clamavservice])
subprocess.call(['systemctl', 'enable', 'wallace.service'])
elif os.path.isfile('/sbin/chkconfig'):
subprocess.call(['chkconfig', 'postfix', 'on'])
diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py
index 8c38111..2b3e17c 100644
--- a/pykolab/setup/setup_mysql.py
+++ b/pykolab/setup/setup_mysql.py
@@ -62,7 +62,9 @@ def execute(*args, **kw):
mysqlservice = 'mysqld.service'
if os.path.isfile('/usr/lib/systemd/system/mariadb.service'):
mysqlservice = 'mariadb.service'
- if os.path.isfile('/bin/systemctl') and not os.path.isfile('/usr/lib/systemd/system/' + mysqlservice):
+ elif os.path.isfile('/usr/lib/systemd/system/mysql.service'):
+ mysqlservice = 'mysql.service'
+ if not os.path.isfile('/usr/lib/systemd/system/' + mysqlservice):
# on Debian Jessie, systemctl restart mysql
mysqlservice = 'mysql'
diff --git a/pykolab/setup/setup_roundcube.py b/pykolab/setup/setup_roundcube.py
index 22eb9ab..6519a79 100644
--- a/pykolab/setup/setup_roundcube.py
+++ b/pykolab/setup/setup_roundcube.py
@@ -89,9 +89,26 @@ def execute(*args, **kw):
'conf': conf
}
- if os.access('/usr/share/roundcubemail/skins/enterprise/', os.R_OK):
+ rc_paths = [
+ "/usr/share/roundcubemail/",
+ "/usr/share/roundcube/",
+ "/srv/www/roundcubemail/",
+ "/var/www/roundcubemail/"
+ ]
+
+ rcpath = ''
+ for rc_path in rc_paths:
+ if os.path.isdir(rc_path):
+ rcpath = rc_path
+ break
+
+ if not os.path.isdir(rcpath):
+ log.error(_("Roundcube installation path not found."))
+ return
+
+ if os.access(rcpath + 'skins/enterprise/', os.R_OK):
rc_settings['skin'] = 'enterprise'
- elif os.access('/usr/share/roundcubemail/skins/chameleon/', os.R_OK):
+ elif os.access(rcpath + 'skins/chameleon/', os.R_OK):
rc_settings['skin'] = 'chameleon'
else:
rc_settings['skin'] = 'larry'
@@ -161,14 +178,6 @@ def execute(*args, **kw):
break
break
- if os.path.isdir('/usr/share/roundcubemail'):
- rcpath = '/usr/share/roundcubemail/'
- elif os.path.isdir('/usr/share/roundcube'):
- rcpath = '/usr/share/roundcube/'
- else:
- log.error(_("Roundcube installation path not found."))
- return
-
for root, directories, filenames in os.walk(rcpath + 'plugins/calendar/drivers/kolab/'):
for filename in filenames:
if filename.startswith('mysql') and filename.endswith('.sql'):
@@ -239,7 +248,7 @@ password='%s'
root_uid = 0
- for webserver_group in [ 'apache', 'www-data' ]:
+ for webserver_group in [ 'apache', 'www-data', 'www' ]:
try:
(a,b,webserver_gid,c) = grp.getgrnam(webserver_group)
break
@@ -251,11 +260,12 @@ password='%s'
for filename in filenames:
os.chown(os.path.join(root, filename), root_uid, webserver_gid)
+ httpservice = 'httpd.service'
+ if os.path.isfile('/usr/lib/systemd/system/apache2.service'):
+ httpservice = 'apache2.service'
+
if os.path.isfile('/bin/systemctl'):
- if os.path.isfile('/etc/debian_version'):
- subprocess.call(['/bin/systemctl', 'restart', 'apache2.service'])
- else:
- subprocess.call(['/bin/systemctl', 'restart', 'httpd.service'])
+ subprocess.call(['/bin/systemctl', 'restart', httpservice])
elif os.path.isfile('/sbin/service'):
subprocess.call(['/sbin/service', 'httpd', 'restart'])
elif os.path.isfile('/usr/sbin/service'):
@@ -264,10 +274,7 @@ password='%s'
log.error(_("Could not start the webserver server service."))
if os.path.isfile('/bin/systemctl'):
- if os.path.isfile('/etc/debian_version'):
- subprocess.call(['/bin/systemctl', 'enable', 'apache2.service'])
- else:
- subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
+ subprocess.call(['/bin/systemctl', 'enable', httpservice])
elif os.path.isfile('/sbin/chkconfig'):
subprocess.call(['/sbin/chkconfig', 'httpd', 'on'])
elif os.path.isfile('/usr/sbin/update-rc.d'):
diff --git a/pykolab/setup/setup_syncroton.py b/pykolab/setup/setup_syncroton.py
index 9fdb04c..2f02d98 100644
--- a/pykolab/setup/setup_syncroton.py
+++ b/pykolab/setup/setup_syncroton.py
@@ -86,11 +86,12 @@ password='%s'
time.sleep(2)
+ httpservice = 'httpd.service'
+ if os.path.isfile('/usr/lib/systemd/system/apache2.service'):
+ httpservice = 'apache2.service'
+
if os.path.isfile('/bin/systemctl'):
- if os.path.isfile('/etc/debian_version'):
- subprocess.call(['/bin/systemctl', 'restart', 'apache2.service'])
- else:
- subprocess.call(['/bin/systemctl', 'restart', 'httpd.service'])
+ subprocess.call(['/bin/systemctl', 'restart', httpservice])
elif os.path.isfile('/sbin/service'):
subprocess.call(['/sbin/service', 'httpd', 'restart'])
elif os.path.isfile('/usr/sbin/service'):
@@ -99,10 +100,7 @@ password='%s'
log.error(_("Could not start the webserver server service."))
if os.path.isfile('/bin/systemctl'):
- if os.path.isfile('/etc/debian_version'):
- subprocess.call(['/bin/systemctl', 'enable', 'apache2.service'])
- else:
- subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
+ subprocess.call(['/bin/systemctl', 'enable', httpservice])
elif os.path.isfile('/sbin/chkconfig'):
subprocess.call(['/sbin/chkconfig', 'httpd', 'on'])
elif os.path.isfile('/usr/sbin/update-rc.d'):