diff --git a/pykolab/setup/setup_imap.py b/pykolab/setup/setup_imap.py --- a/pykolab/setup/setup_imap.py +++ b/pykolab/setup/setup_imap.py @@ -142,10 +142,14 @@ 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 @@ 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 --- a/pykolab/setup/setup_mta.py +++ b/pykolab/setup/setup_mta.py @@ -369,7 +369,19 @@ 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 @@ 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 @@ 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 @@ 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 --- a/pykolab/setup/setup_mysql.py +++ b/pykolab/setup/setup_mysql.py @@ -62,7 +62,9 @@ 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 --- a/pykolab/setup/setup_roundcube.py +++ b/pykolab/setup/setup_roundcube.py @@ -89,9 +89,26 @@ '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 @@ 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 @@ 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 @@ 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 @@ 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 --- a/pykolab/setup/setup_syncroton.py +++ b/pykolab/setup/setup_syncroton.py @@ -86,11 +86,12 @@ 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 @@ 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'):