Add new OS/Distro

  1. OS support overview
  2. OAL overview

OS support overview

VMCCdfL was originally developed on a Ubuntu system. Being a python application it should run on any Unix-based system with python support relatively easily right? Well, unfortunately, that is not the case. Distros like to patch packages, add and remove features, patch command line options, ship 'em vanilla, etc. This results on some minor (and not so minor) differences in packages and paths between distributions that made necessary to develop a small layer to abstracts these differences. The module vmc.common.oal was born, OAL stands for OS Abstraction Layer.

Differences found so far

  1. Depending on the distribution, trying to open a serial port will result in a "no permissions" exception. This is because depending on the distro and the security capabilities enabled the default user doesn't has permissions to open it.
  2. Depending on the distribution, pppd includes a patch that enables a new directive (replacedefaultroute) that is not included in upstream's pppd. So far the only distro we have seen without these patches included is Fedora.
  3. Depending on the distribution, pppd will be suid or not. This means that in distributions like SuSe we will have to start wvdial with gksudo. Oh did I mention that gksudo only exists in some distributions? SuSe provides gnomesu, (which of course has a different syntax from gksudo), while Fedora doesn't provides anything. This means that in distros like Ubuntu we won't need any special setup to connect to the internet, in SuSe we will have to provide a valid password in order to start wvdial, and in Fedora we have to install gksu from an external repository. This gksu has yet another syntax of course
  4. Depending on the distribution, wvdial has a different command line syntax. In Ubuntu/Debian, the parameter to specify a custom config file is '-C', while in Fedora/Suse is '--config'.

OAL overview

OAL provides a function called mark_for_oal that must be used like gettext's _. If you have a path/string that is OS dependent, you can mark it and it will be translated in runtime to the appropiated value.

Obviously you must specify beforehand the value of those translations. In order to do so, you must override the BaseDistribution class. Take for example the DebianBasedDistribution class:

class DebianBasedDistribution(BaseDistribution):
    __required__ = '/etc/debian_version'

The __required__ attribute specifies a file which if exists, means that VMCCdfL is running on the given OS/Distro.

Now lets have a look at the SuSeBasedDistribution class:

class SuseBasedDistribution(BaseDistribution):
    __required__ = '/etc/SuSE-release'
    customization = {'WVDIAL_CONN_SWITCH' : '--config',
                     'gksudo_name' : 'gnomesu'}

The customization attribute is a dictionary whose keys are the mark_for_oal identifier and the corresponding value for that OS/Distro. If the attribute is present in a class, the default dictionary will be updated with the new values.

Register the new OS with the OS DB

You have to register your new class with the OS DB. Add a reference of your class to OSNAME_COLLECTION. In the future, you will have to copy your plugin to the plugin dir.

Index