1. Zhang Huangbin
  2. iredmail

Commits

Zhang Huangbin  committed 55da5cc

MariaDB support on Ubuntu 14.04.

  • Participants
  • Parent commits b98948f
  • Branches default

Comments (0)

Files changed (10)

File iRedMail/ChangeLog

View file
 iRedMail-0.9.0:
     * Works on new Linux/BSD distribution releases:
-        - Ubuntu 14.04 LTS
+        - Ubuntu 14.04 LTS. With MariaDB support.
 
     * Drop support for below releases:
         - Ubuntu 13.04, 13.10

File iRedMail/conf/apache_php

View file
     export HTTPD_CONF_ROOT="/etc/apache2"
     export HTTPD_CONF="${HTTPD_CONF_ROOT}/apache2.conf"
     if [ X"${DISTRO_CODENAME}" == X'wheezy' \
-        -o X"${DISTRO_CODENAME}" == X'precise' \
-        -o X"${DISTRO_CODENAME}" == X'raring' ]; then
+        -o X"${DISTRO_CODENAME}" == X'precise' ]; then
         export HTTPD_CONF_DIR="${HTTPD_CONF_ROOT}/conf.d"
         export HTTPD_SSL_CONF="${HTTPD_CONF_ROOT}/sites-available/default-ssl"
         export HTTPD_MOD_CONF_SECURITY="${HTTPD_CONF_DIR}/security"

File iRedMail/conf/global

View file
 export ENABLE_BACKEND_OPENLDAP='YES'
 export ENABLE_BACKEND_MYSQL='YES'
 export ENABLE_BACKEND_PGSQL='YES'
+# MariaDB
+export ENABLE_BACKEND_MARIADB='NO'
 # OpenBSD built-in LDAP daemon
 export ENABLE_BACKEND_LDAPD='NO'
 
     export enable_service="enable_service_debian"
     export disable_service="disable_service_debian"
 
-    # Syslog config: rsyslog.
     if [ X"${DISTRO}" == X"UBUNTU" ]; then
+        # Syslog config: rsyslog.
         # Ubuntu >= 9.10
         export SYSLOG_CONF='/etc/rsyslog.d/iredmail.conf'
         export SYSLOG_POSTROTATE_CMD='reload rsyslog >/dev/null 2>&1 || true'
+
+        # MariaDB support requires Ubuntu >= 14.04
+        if [ X"${DISTRO_CODENAME}" != X'precise' ]; then
+            export ENABLE_BACKEND_MARIADB='YES'
+        fi
     fi
 
     if [ X"${DISTRO}" == X"DEBIAN" ]; then

File iRedMail/conf/phppgadmin

View file
     export PHPPGADMIN_HTTPD_ROOT="/usr/share/phppgadmin"
     export PHPPGADMIN_HTTPD_ROOT_SYMBOL_LINK="${PHPPGADMIN_HTTPD_ROOT}"
     if [ X"${DISTRO_CODENAME}" == X'wheezy' \
-        -o X"${DISTRO_CODENAME}" == X'precise' \
-        -o X"${DISTRO_CODENAME}" == X'raring' ]; then
+        -o X"${DISTRO_CODENAME}" == X'precise' ]; then
         export PHPPGADMIN_HTTPD_CONF="${HTTPD_CONF_DIR}/phppgadmin"
     else
         export PHPPGADMIN_HTTPD_CONF="${HTTPD_CONF_DIR}/phppgadmin.conf"

File iRedMail/dialog/config_via_dialog.sh

View file
 # --------------------- Backends --------------------
 # --------------------------------------------------
 export DIALOG_AVAILABLE_BACKENDS=''
-if [ X"${ENABLE_BACKEND_LDAPD}" == X"YES" ]; then
+if [ X"${ENABLE_BACKEND_LDAPD}" == X'YES' ]; then
     export DIALOG_AVAILABLE_BACKENDS="${DIALOG_AVAILABLE_BACKENDS} ldapd The_OpenBSD_built-in_LDAP_server off"
 fi
-if [ X"${ENABLE_BACKEND_OPENLDAP}" == X"YES" ]; then
+if [ X"${ENABLE_BACKEND_OPENLDAP}" == X'YES' ]; then
     export DIALOG_AVAILABLE_BACKENDS="${DIALOG_AVAILABLE_BACKENDS} OpenLDAP An_open_source_implementation_of_LDAP_protocol off"
 fi
 
-if [ X"${ENABLE_BACKEND_MYSQL}" == X"YES" ]; then
+if [ X"${ENABLE_BACKEND_MYSQL}" == X'YES' ]; then
     export DIALOG_AVAILABLE_BACKENDS="${DIALOG_AVAILABLE_BACKENDS} MySQL Most_popular_open_source_database off"
 fi
 
-if [ X"${ENABLE_BACKEND_PGSQL}" == X"YES" ]; then
+if [ X"${ENABLE_BACKEND_MARIADB}" == X'YES' ]; then
+    export DIALOG_AVAILABLE_BACKENDS="${DIALOG_AVAILABLE_BACKENDS} MariaDB An_enhanced,_drop-in_replacement_for_MySQL off"
+fi
+
+if [ X"${ENABLE_BACKEND_PGSQL}" == X'YES' ]; then
     export DIALOG_AVAILABLE_BACKENDS="${DIALOG_AVAILABLE_BACKENDS} PostgreSQL Powerful,_open_source_database_system off"
 fi
 
     export BACKEND='OPENLDAP'
 elif [ X"${BACKEND_ORIG}" == X'MYSQL' ]; then
     export BACKEND='MYSQL'
+elif [ X"${BACKEND_ORIG}" == X'MARIADB' ]; then
+    export BACKEND='MYSQL'
+    export BACKEND_ORIG='MARIADB'
 elif [ X"${BACKEND_ORIG}" == X'POSTGRESQL' ]; then
     export BACKEND='PGSQL'
     export BACKEND_ORIG='PGSQL'

File iRedMail/functions/apache_php.sh

View file
 
         [ X"${BACKEND}" == X"OPENLDAP" ] && a2enmod authnz_ldap > /dev/null
         if [ X"${BACKEND}" == X"MYSQL" ]; then
-            if [ X"${DISTRO_CODENAME}" == X'wheezy' \
-                -o X"${DISTRO_CODENAME}" == X'precise' \
-                -o X"${DISTRO_CODENAME}" == X'raring' ]; then
-                a2enmod auth_mysql > /dev/null
-            fi
+            a2enmod auth_mysql > /dev/null
         fi
 
         if [ X"${BACKEND}" == X"PGSQL" ]; then
-            if [ X"${DISTRO_CODENAME}" == X'wheezy' \
-                -o X"${DISTRO_CODENAME}" == X'precise' \
-                -o X"${DISTRO_CODENAME}" == X'raring' ]; then
-                a2enmod 000_auth_pgsql > /dev/null
-            fi
+            a2enmod 000_auth_pgsql > /dev/null
         fi
 
     elif [ X"${DISTRO}" == X'FREEBSD' ]; then

File iRedMail/functions/awstats.sh

View file
 
 
         elif [ X"${DISTRO}" == X'DEBIAN' -o X"${DISTRO}" == X'UBUNTU' ]; then
-            if [ X"${DISTRO_CODENAME}" == X'wheezy' \
-                -o X"${DISTRO_CODENAME}" == X'precise' ]; then
-                cat >> ${AWSTATS_HTTPD_CONF} <<EOF
+            cat >> ${AWSTATS_HTTPD_CONF} <<EOF
     AuthMYSQL on
     AuthBasicAuthoritative Off
     AuthUserFile /dev/null
     Auth_MySQL_Authoritative On
     #AuthMySQLUserCondition "isglobaladmin=1"
 EOF
-                cat >> ${HTTPD_CONF} <<EOF
+
+            cat >> ${HTTPD_CONF} <<EOF
 # MySQL auth (libapache2-mod-auth-apache2).
 # Global config of MySQL server address, username, password.
 Auth_MySQL_Info ${SQL_SERVER} ${VMAIL_DB_BIND_USER} ${VMAIL_DB_BIND_PASSWD}
 Auth_MySQL_General_DB ${VMAIL_DB}
 EOF
-
-            else
-                perl -pi -e 's#(<Directory .*)#DBDriver mysql\n${1}#' ${AWSTATS_HTTPD_CONF}
-                perl -pi -e 's#(<Directory .*)#DBDParams "host=$ENV{SQL_SERVER} port=$ENV{SQL_SERVER_PORT} dbname=$ENV{VMAIL_DB} user=$ENV{VMAIL_DB_BIND_USER} pass=$ENV{VMAIL_DB_BIND_PASSWD}"\n${1}#' ${AWSTATS_HTTPD_CONF}
-
-                cat >> ${AWSTATS_HTTPD_CONF} <<EOF
-    AuthBasicProvider dbd
-    AuthDBDUserPWQuery "SELECT password FROM mailbox WHERE username=%s AND isglobaladmin=1"
-EOF
-
-                a2enconf awstats &>/dev/null
-                a2enmod authn_dbd &>/dev/null
-            fi
+            a2enconf awstats &>/dev/null
 
             # Set file permission.
             chmod 0600 ${AWSTATS_HTTPD_CONF}

File iRedMail/functions/cluebringer.sh

View file
             fi
 
         elif [ X"${DISTRO}" == X'DEBIAN' -o X"${DISTRO}" == X'UBUNTU' ]; then
-            if [ X"${DISTRO_CODENAME}" == X'wheezy' \
-                -o X"${DISTRO_CODENAME}" == X'precise' \
-                -o X"${DISTRO_CODENAME}" == X'raring' ]; then
-                cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
+            cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
     AuthMYSQL on
     AuthBasicAuthoritative Off
     AuthUserFile /dev/null
     AuthMySQL_Encryption_Types Crypt_MD5
     Auth_MySQL_Authoritative On
 EOF
-                cat >> ${HTTPD_CONF} <<EOF
+            cat >> ${HTTPD_CONF} <<EOF
 # MySQL auth (libapache2-mod-auth-apache2).
 # Global config of MySQL server, username, password.
 Auth_MySQL_Info ${SQL_SERVER} ${VMAIL_DB_BIND_USER} ${VMAIL_DB_BIND_PASSWD}
 Auth_MySQL_General_DB ${VMAIL_DB}
 EOF
-            else
-                # Apache 2.4 with apr-util1-dbd-mysql
-                perl -pi -e 's#(<Directory .*)#DBDriver mysql\n${1}#' ${CLUEBRINGER_HTTPD_CONF}
-                perl -pi -e 's#(<Directory .*)#DBDParams "host=$ENV{SQL_SERVER} port=$ENV{SQL_SERVER_PORT} dbname=$ENV{VMAIL_DB} user=$ENV{VMAIL_DB_BIND_USER} pass=$ENV{VMAIL_DB_BIND_PASSWD}"\n${1}#' ${CLUEBRINGER_HTTPD_CONF}
 
-                cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
-    AuthBasicProvider dbd
-    AuthDBDUserPWQuery "SELECT password FROM mailbox WHERE username=%s AND isglobaladmin=1"
-EOF
-
-                if [ X"${DISTRO}" == X'DEBIAN' -o X"${DISTRO}" == X'UBUNTU' ]; then
-                    a2enconf zcluebringer &>/dev/null
-                    a2enmod authn_dbd &>/dev/null
-                fi
-            fi
+            a2enconf cluebringer &>/dev/null
 
             # Set file permission.
             chmod 0600 ${CLUEBRINGER_HTTPD_CONF}

File iRedMail/functions/packages.sh

View file
             PKG_SCRIPTS="${PKG_SCRIPTS} ${MYSQL_RC_SCRIPT_NAME}"
 
         fi
-    elif [ X"${BACKEND}" == X"MYSQL" ]; then
+    elif [ X"${BACKEND}" == X'MYSQL' ]; then
         # MySQL server & client.
         ENABLED_SERVICES="${ENABLED_SERVICES} ${MYSQL_RC_SCRIPT_NAME}"
         if [ X"${DISTRO}" == X"RHEL" ]; then
         elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
             # MySQL server and client.
             if [ X"${USE_LOCAL_MYSQL_SERVER}" == X'YES' ]; then
-                ALL_PKGS="${ALL_PKGS} mysql-server"
+                if [ X"${BACKEND_ORIG}" == X'MARIADB' ]; then
+                    ALL_PKGS="${ALL_PKGS} mariadb-server mariadb-client"
+                else
+                    ALL_PKGS="${ALL_PKGS} mysql-server mysql-client"
+                fi
             fi
-            ALL_PKGS="${ALL_PKGS} mysql-client postfix-mysql"
 
-            if [ X"${DISTRO_CODENAME}" == X'wheezy' \
-                -o X"${DISTRO_CODENAME}" == X'precise' \
-                -o X"${DISTRO_CODENAME}" == X'raring' ]; then
-                ALL_PKGS="${ALL_PKGS} libapache2-mod-auth-mysql"
-            else
-                ALL_PKGS="${ALL_PKGS} libaprutil1-dbd-mysql"
-            fi
+            ALL_PKGS="${ALL_PKGS} postfix-mysql libapache2-mod-auth-mysql"
 
         elif [ X"${DISTRO}" == X'OPENBSD' ]; then
             if [ X"${USE_LOCAL_MYSQL_SERVER}" == X'YES' ]; then
 
         elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
             # postgresql-contrib provides extension 'dblink' used in Roundcube password plugin.
-            ALL_PKGS="${ALL_PKGS} postgresql postgresql-client postgresql-contrib postfix-pgsql"
-
-            if [ X"${DISTRO_CODENAME}" == X'wheezy' \
-                -o X"${DISTRO_CODENAME}" == X'precise' \
-                -o X"${DISTRO_CODENAME}" == X'raring' ]; then
-                ALL_PKGS="${ALL_PKGS} libapache2-mod-auth-pgsql"
-            else
-                ALL_PKGS="${ALL_PKGS} libaprutil1-dbd-pgsql"
-            fi
+            ALL_PKGS="${ALL_PKGS} postgresql postgresql-client postgresql-contrib postfix-pgsql libapache2-mod-auth-pgsql"
 
         elif [ X"${DISTRO}" == X'OPENBSD' ]; then
             ALL_PKGS="${ALL_PKGS} postgresql-client postgresql-server postgresql-contrib"
         ENABLED_SERVICES="${ENABLED_SERVICES} ${CLUEBRINGER_RC_SCRIPT_NAME}"
 
         if [ X"${BACKEND}" == X"OPENLDAP" -o X"${BACKEND}" == X"MYSQL" ]; then
-            ALL_PKGS="${ALL_PKGS} postfix-cluebringer-mysql"
+            if [ X"${BACKEND_ORIG}" != X'MARIADB' ]; then
+                ALL_PKGS="${ALL_PKGS} postfix-cluebringer-mysql"
+            fi
         elif [ X"${BACKEND}" == X"PGSQL" ]; then
             ALL_PKGS="${ALL_PKGS} postfix-cluebringer-pgsql"
         fi

File iRedMail/functions/roundcubemail.sh

View file
 
     # Enable this config file on Ubuntu 13.10 and later releases.
     if [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
-        if [ X"${DISTRO_CODENAME}" == X'wheezy' \
-            -o X"${DISTRO_CODENAME}" == X'precise' \
-            -o X"${DISTRO_CODENAME}" == X'raring' ]; then
-            :
-        else
+        if [ X"${DISTRO_CODENAME}" != X'wheezy' \
+            -a X"${DISTRO_CODENAME}" != X'precise' ]; then
             # Enable conf file: conf-available/roundcubemail.conf
             a2enconf roundcubemail &>/dev/null
         fi