Add partial openSUSE/SLE support

Note that this is the first part of the support. A second part involves
dealing with the package names.

Among the changes:
 - add several functions to determine some distro-specific behavior (how
   to call usermod, if some features are available on the distro, etc.)
 - correctly detect openSUSE and SLE in GetOSVersion, and set DISTRO
   accordingly
 - new is_suse() function to check if running on a SUSE-based distro
 - use zypper to install packages
 - adapt apache virtual host configuration for openSUSE
 - some simple fixes (path to pip, mysql service name)

Change-Id: Id2f7c9e18a1c4a7b7cea262ea7959d183e4b0cf0
diff --git a/lib/horizon b/lib/horizon
index c6c96da..af09f77 100644
--- a/lib/horizon
+++ b/lib/horizon
@@ -81,9 +81,17 @@
         sudo a2ensite horizon
     else
         # Install httpd, which is NOPRIME'd
-        APACHE_NAME=httpd
-        APACHE_CONF=conf.d/horizon.conf
-        sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
+        if is_suse; then
+            APACHE_NAME=apache2
+            APACHE_CONF=vhosts.d/horizon.conf
+            # Append wsgi to the list of modules to load
+            grep -q "^APACHE_MODULES=.*wsgi" /etc/sysconfig/apache2 ||
+                sudo sed '/^APACHE_MODULES=/s/^\(.*\)"$/\1 wsgi"/' -i /etc/sysconfig/apache2
+        else
+            APACHE_NAME=httpd
+            APACHE_CONF=conf.d/horizon.conf
+            sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
+        fi
     fi
 
     # Configure apache to run horizon