[Kolab-devel] Proposal - Distro specific changes for Kolab 3

Aeneas Jaißle jaissle at sewikom.de
Wed May 22 15:36:41 CEST 2013


Hi everybody,

I'd like to enhance Kolab's distribution support and make live for (us) packagers easier.

For that, I put a layer between paths, service names, user and groups (= between all that could differ on another distribution).

This layer eventually is a settings.py, that
1) Loads default settings
2) Selects and loads (optional) distribution specific settings, overwriting the default settings
3) Loads (optional) custom settings, overwriting default and distribution specific settings

I'd use something similar to the following (as I have to get used to python, there might be some errors):

import platform
from pykolab.settings_default import *

distribution = platform.linux_distribution()
if distribution[0] = 'openSUSE':
   from pykolab.settings_suse import *
elif distribution[0] = 'Fedora':
    from pykolab.settings_fedora import *
elif distribution[0] = 'Mageia':
    from pykolab.settings_mageia import *
elif distribution[0] = 'Debian':
    from pykolab.settings_debian import *
...
else:
    log.error(_("Unknown or unsupported distribution, falling back to default"))

from pykolab.settings_custom import *


Settings are also stored in python files. settings_default.py would have something like
    s_cyrus-imapd = 'cyrus-imapd.service'
    s_kolabd = 'kolabd.service'
    s_postfix = 'postfix.service'
    s_amavisd = 'amavisd.service'
    s_clamd = 'clamd.service'
    s_wallace = 'wallace.service'
    s_mysqld = 'mysqld.service'
    s_httpd = 'httpd.service'
    if service_type = 'systemd':
        bin_systemctl = '/bin/systemctl'

While settings_suse.py only has
    s_httpd = 'apache2.service'
    service_type = 'systemd'

Services would be called 
    def s_restart_httpd:
        subprocess.call([bin_systemctl, s_httpd, 'restart'])

setup_roundcubemail.py:
from pykolab.settings import *
...
s_restart_httpd

pykolab would only load the settings, packagers would adjust everything once inside their settings_dist.py (having everything in one place) and add their distribution to settings.py. They would only have to change settings, if these differ from the defaults. Users could further customize their installation, changing settings in settings_custom.py.


Is something like this wanted upstream? Would this be the rights way to do (in python)? Feedback welcome!

- Aeneas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kolab.org/pipermail/devel/attachments/20130522/aadd6f98/attachment.html>


More information about the devel mailing list