Commits

Zhang Huangbin  committed fad54b0

WIP: It now works on openSUSE-12.3.

  • Participants
  • Parent commits 48cc012

Comments (0)

Files changed (4)

File iRedMail/conf/global

         # openSUSE
         export DISTRO='SUSE'
 
-        # Version number. e.g. 12.1
+        # Version number. e.g. 12.3
         export DISTRO_VERSION="$(grep 'VERSION' /etc/SuSE-release | awk '{print $3}')"
 
         # code name
         #   - 12.2: mantis
+        #   - 12.3: dartmouth
         export DISTRO_CODENAME="$(grep 'CODENAME' /etc/SuSE-release | awk '{print $3}' |tr [A-Z] [a-z])"
 
         # Unsupported releases: 10.x, 11.x, 12.1 (asparagus).

File iRedMail/conf/policy_server

 export USE_POLICYD='YES'
 
 # Use Policyd-2.x (cluebringer).
-if [ X"${DISTRO}" == X'RHEL' -o X"${DISTRO}" == X'SUSE' ]; then
+if [ X"${DISTRO}" == X'RHEL' ]; then
     if [ X"${BACKEND}" == X'PGSQL' ]; then
         export USE_CLUEBRINGER='YES'
         export USE_POLICYD='NO'
     fi
+elif [ X"${DISTRO}" == X'SUSE' ]; then
+    if [ X"${DISTRO_CODENAME}" == X'mantis' ]; then
+        # Use cluebringer in openSUSE-12.2 with PostgreSQL backend
+        if [ X"${BACKEND}" == X'PGSQL' ]; then
+            export USE_CLUEBRINGER='YES'
+            export USE_POLICYD='NO'
+        fi
+    else
+        # Use cluebringer in openSUSE-12.3 and later releases.
+        export USE_CLUEBRINGER='YES'
+        export USE_POLICYD='NO'
+    fi
 elif [ X"${DISTRO}" == X'DEBIAN' ]; then
     if [ X"${DISTRO_CODENAME}" == X'wheezy' ]; then
         export USE_CLUEBRINGER='YES'

File iRedMail/functions/cluebringer.sh

     # Get SQL structure template file.
     tmp_sql="/tmp/cluebringer_init_sql.${RANDOM}${RANDOM}"
     if [ X"${DISTRO}" == X"RHEL" -o X"${DISTRO}" == X"SUSE" ]; then
+        DB_SAMPLE_FILE_NAME='DATABASE.mysql'
+
+        if [ X"${DISTRO}" == X'SUSE' ]; then
+            DB_SAMPLE_FILE_NAME='policyd.mysql.sql'
+            cat > ${tmp_sql} <<EOF
+CREATE DATABASE ${CLUEBRINGER_DB_NAME};
+USE ${CLUEBRINGER_DB_NAME};
+EOF
+        fi
+
+        DB_SAMPLE_FILE="$(eval ${LIST_FILES_IN_PKG} ${PKG_CLUEBRINGER} | grep "/${DB_SAMPLE_FILE_NAME}$")"
+        perl -pi -e 's#TYPE=#ENGINE=#g' ${DB_SAMPLE_FILE}
+
         if [ X"${BACKEND}" == X"OPENLDAP" -o X"${BACKEND}" == X"MYSQL" ]; then
-            cat > ${tmp_sql} <<EOF
+            cat >> ${tmp_sql} <<EOF
 -- Import SQL structure template.
-SOURCE $(eval ${LIST_FILES_IN_PKG} ${PKG_CLUEBRINGER} | grep '/DATABASE.mysql$');
+SOURCE ${DB_SAMPLE_FILE};
 
 -- Grant privileges.
 GRANT SELECT,INSERT,UPDATE,DELETE ON ${CLUEBRINGER_DB_NAME}.* TO "${CLUEBRINGER_DB_USER}"@"${SQL_HOSTNAME}" IDENTIFIED BY "${CLUEBRINGER_DB_PASSWD}";

File iRedMail/functions/packages.sh

         DISABLED_SERVICES="${DISABLED_SERVICES} spamassassin"
 
     elif [ X"${DISTRO}" == X"SUSE" ]; then
-        ALL_PKGS="${ALL_PKGS} perl-Mail-SPF amavisd-new clamav clamav-db spamassassin altermime"
+        ALL_PKGS="${ALL_PKGS} perl-Mail-SPF amavisd-new clamav spamassassin altermime"
+
+        # openSUSE-12.2. package 'clamav-db' is not required in openSUSE-12.3.
+        [ X"${DISTRO_CODENAME}" == X'mantis' ] && ALL_PKGS="${ALL_PKGS} clamav-db"
 
         [ X"${BACKEND}" == X'OPENLDAP' ] && ALL_PKGS="${ALL_PKGS} perl-ldap perl-DBD-mysql"
         [ X"${BACKEND}" == X'MYSQL' ] && ALL_PKGS="${ALL_PKGS} perl-DBD-mysql"