Commits

Zhang Huangbin committed aa3d65d

Rename variables to avoid namespace conflict on FreeBSD.

Comments (0)

Files changed (2)

iRedMail/conf/core

         value="${2}"
         final_option="${1}=${2}"
         comment_mark="# ${PROG_NAME}-${var}"
-        if [ X"${var}" == X'DEFAULT_VERSIONS' ]; then
+        if ! grep "^${comment_mark}$" ${FREEBSD_MAKE_CONF} &>/dev/null; then
+            ECHO_DEBUG "Add make option in ${FREEBSD_MAKE_CONF}: ${final_option}"
+            echo "${comment_mark}" >> ${FREEBSD_MAKE_CONF}
             echo "${final_option}" >> ${FREEBSD_MAKE_CONF}
         else
-            if ! grep "^${comment_mark}$" ${FREEBSD_MAKE_CONF} &>/dev/null; then
-                ECHO_DEBUG "Add make option in ${FREEBSD_MAKE_CONF}: ${final_option}"
-                echo "${comment_mark}" >> ${FREEBSD_MAKE_CONF}
-                echo "${final_option}" >> ${FREEBSD_MAKE_CONF}
-            else
-                ECHO_DEBUG "Skip adding option in ${FREEBSD_MAKE_CONF}: ${final_option}"
-            fi
+            ECHO_DEBUG "Skip adding option in ${FREEBSD_MAKE_CONF}: ${final_option}"
         fi
     fi
 }

iRedMail/functions/packages_freebsd.sh

     export PACKAGE_BUILDING='yes'
     export BATCH='yes'
 
-    export WANT_OPENLDAP_VER='24'
-    export WANT_MARIADB_VER='55'
-    export WANT_PGSQL_VER='93'
-    export WANT_BDB_VER='48'
-    export WANT_APACHE_VER='22'
+    export PREFERRED_OPENLDAP_VER='24'
+    export PREFERRED_MARIADB_VER='55'
+    export PREFERRED_PGSQL_VER='93'
+    export PREFERRED_BDB_VER='48'
+    export PREFERRED_APACHE_VER='22'
 
     if [ X"${BACKEND_ORIG}" == X'MARIADB' ]; then
-        export WANT_MYSQL_VER='55m'
+        export PREFERRED_MYSQL_VER='55m'
     else
-        export WANT_MYSQL_VER='55'
+        export PREFERRED_MYSQL_VER='55'
     fi
 
     freebsd_add_make_conf 'OPTIONS_SET' 'SASL'
     freebsd_add_make_conf 'OPTIONS_UNSET' 'X11'
-    freebsd_add_make_conf 'WANT_OPENLDAP_VER' "${WANT_OPENLDAP_VER}"
-    freebsd_add_make_conf 'WANT_MYSQL_VER' "${WANT_MYSQL_VER}"
-    freebsd_add_make_conf 'WANT_MARIADB_VER' "${WANT_MARIADB_VER}"
-    freebsd_add_make_conf 'WANT_PGSQL_VER' "${WANT_PGSQL_VER}"
-    freebsd_add_make_conf 'APACHE_PORT' "www/apache${WANT_APACHE_VER}"
-    freebsd_add_make_conf 'WANT_BDB_VER' "${WANT_BDB_VER}"
-    freebsd_add_make_conf 'DEFAULT_VERSIONS' 'python=2.7 python2=2.7'
-    freebsd_add_make_conf 'DEFAULT_VERSIONS' '+=apache=2.2'
+    freebsd_add_make_conf 'PREFERRED_OPENLDAP_VER' "${PREFERRED_OPENLDAP_VER}"
+    freebsd_add_make_conf 'PREFERRED_MYSQL_VER' "${PREFERRED_MYSQL_VER}"
+    freebsd_add_make_conf 'PREFERRED_MARIADB_VER' "${PREFERRED_MARIADB_VER}"
+    freebsd_add_make_conf 'PREFERRED_PGSQL_VER' "${PREFERRED_PGSQL_VER}"
+    freebsd_add_make_conf 'APACHE_PORT' "www/apache${PREFERRED_APACHE_VER}"
+    freebsd_add_make_conf 'PREFERRED_BDB_VER' "${PREFERRED_BDB_VER}"
+    freebsd_add_make_conf 'DEFAULT_VERSIONS' "python=2.7 python2=2.7 apache=2.2 pgsql=${PREFERRED_PGSQL_VER}"
 
     for p in \
         archivers_p5-Archive-Tar \
         converters_libiconv \
-        databases_postgresql${WANT_PGSQL_VER}-client \
-        databases_postgresql${WANT_PGSQL_VER}-contrib \
-        databases_postgresql${WANT_PGSQL_VER}-server \
+        databases_postgresql${PREFERRED_PGSQL_VER}-client \
+        databases_postgresql${PREFERRED_PGSQL_VER}-contrib \
+        databases_postgresql${PREFERRED_PGSQL_VER}-server \
         databases_py-MySQLdb \
         devel_apr1 \
         devel_m4 \
         mail_policyd2 \
         mail_postfix \
         mail_roundcube \
-        net_openldap${WANT_OPENLDAP_VER}-client \
-        net_openldap${WANT_OPENLDAP_VER}-sasl-client \
-        net_openldap${WANT_OPENLDAP_VER}-server \
+        net_openldap${PREFERRED_OPENLDAP_VER}-client \
+        net_openldap${PREFERRED_OPENLDAP_VER}-sasl-client \
+        net_openldap${PREFERRED_OPENLDAP_VER}-server \
         net_openslp \
         net_py-ldap2 \
         security_amavisd-new \
         security_libssh2 \
         security_p5-Authen-SASL \
         security_p5-IO-Socket-SSL \
-        www_apache${WANT_APACHE_VER} \
+        www_apache${PREFERRED_APACHE_VER} \
         www_nginx; do
         mkdir -p /var/db/ports/${p} &>/dev/null
     done
 EOF
 
     # OpenLDAP. REQUIRED for LDAP backend.
-    cat > /var/db/ports/net_openldap${WANT_OPENLDAP_VER}-server/options <<EOF
+    cat > /var/db/ports/net_openldap${PREFERRED_OPENLDAP_VER}-server/options <<EOF
 OPTIONS_FILE_SET+=ACCESSLOG
 OPTIONS_FILE_SET+=ACI
 OPTIONS_FILE_SET+=AUDITLOG
 OPTIONS_FILE_SET+=VALSORT
 EOF
 
-    cat > /var/db/ports/net_openldap${WANT_OPENLDAP_VER}-client/options <<EOF
+    cat > /var/db/ports/net_openldap${PREFERRED_OPENLDAP_VER}-client/options <<EOF
 OPTIONS_FILE_UNSET+=FETCH
 EOF
 
-    cat > /var/db/ports/net_openldap${WANT_OPENLDAP_VER}-sasl-client/options <<EOF
+    cat > /var/db/ports/net_openldap${PREFERRED_OPENLDAP_VER}-sasl-client/options <<EOF
 OPTIONS_FILE_UNSET+=FETCH
 EOF
 
     # No options for MySQL server.
     # PostgreSQL
-    cat > /var/db/ports/databases_postgresql${WANT_PGSQL_VER}-server/options <<EOF
+    cat > /var/db/ports/databases_postgresql${PREFERRED_PGSQL_VER}-server/options <<EOF
 OPTIONS_FILE_SET+=INTDATE
 OPTIONS_FILE_SET+=NLS
 OPTIONS_FILE_SET+=SSL
 OPTIONS_FILE_UNSET+=PAM
 EOF
 
-    cat > /var/db/ports/databases_postgresql${WANT_PGSQL_VER}-client/options <<EOF
+    cat > /var/db/ports/databases_postgresql${PREFERRED_PGSQL_VER}-client/options <<EOF
 OPTIONS_FILE_SET+=INTDATE
 OPTIONS_FILE_SET+=NLS
 OPTIONS_FILE_SET+=SSL
 OPTIONS_FILE_UNSET+=PAM
 EOF
 
-    cat > /var/db/ports/databases_postgresql${WANT_PGSQL_VER}-contrib/options <<EOF
+    cat > /var/db/ports/databases_postgresql${PREFERRED_PGSQL_VER}-contrib/options <<EOF
 OPTIONS_FILE_UNSET+=OSSP_UUID
 EOF
 
     if [ X"${BACKEND}" == X"OPENLDAP" ]; then
-        ALL_PORTS="${ALL_PORTS} net/openldap${WANT_OPENLDAP_VER}-sasl-client net/openldap${WANT_OPENLDAP_VER}-server databases/mysql${WANT_MYSQL_VER}-server"
+        ALL_PORTS="${ALL_PORTS} net/openldap${PREFERRED_OPENLDAP_VER}-sasl-client net/openldap${PREFERRED_OPENLDAP_VER}-server databases/mysql${PREFERRED_MYSQL_VER}-server"
     elif [ X"${BACKEND}" == X'MYSQL' ]; then
         if [ X"${BACKEND_ORIG}" == X'MARIADB' ]; then
-            ALL_PORTS="${ALL_PORTS} databases/mariadb${WANT_MARIADB_VER}-server"
+            ALL_PORTS="${ALL_PORTS} databases/mariadb${PREFERRED_MARIADB_VER}-server"
         else
-            ALL_PORTS="${ALL_PORTS} databases/mysql${WANT_MYSQL_VER}-server"
+            ALL_PORTS="${ALL_PORTS} databases/mysql${PREFERRED_MYSQL_VER}-server"
         fi
     elif [ X"${BACKEND}" == X'PGSQL' ]; then
-        ALL_PORTS="${ALL_PORTS} databases/postgresql${WANT_PGSQL_VER}-server databases/postgresql${WANT_PGSQL_VER}-contrib"
+        ALL_PORTS="${ALL_PORTS} databases/postgresql${PREFERRED_PGSQL_VER}-server databases/postgresql${PREFERRED_PGSQL_VER}-contrib"
     fi
 
     # Dovecot v2.0.x. REQUIRED.
 EOF
 
     # Apache v2.2.x. REQUIRED.
-    cat > /var/db/ports/www_apache${WANT_APACHE_VER}/options <<EOF
+    cat > /var/db/ports/www_apache${PREFERRED_APACHE_VER}/options <<EOF
 OPTIONS_FILE_SET+=THREADS
 OPTIONS_FILE_UNSET+=MYSQL
 OPTIONS_FILE_UNSET+=PGSQL
 
     if [ X"${BACKEND}" == X'OPENLDAP' ]; then
         # apr bdb
-        ${CMD_SED} -e 's#OPTIONS_FILE_UNSET+=MYSQL#OPTIONS_FILE_SET+=MYSQL#' /var/db/ports/www_apache${WANT_APACHE_VER}/options
+        ${CMD_SED} -e 's#OPTIONS_FILE_UNSET+=MYSQL#OPTIONS_FILE_SET+=MYSQL#' /var/db/ports/www_apache${PREFERRED_APACHE_VER}/options
         # ldap auth module
-        ${CMD_SED} -e 's#OPTIONS_FILE_UNSET+=LDAP#OPTIONS_FILE_SET+=LDAP#' /var/db/ports/www_apache${WANT_APACHE_VER}/options
-        ${CMD_SED} -e 's#OPTIONS_FILE_UNSET+=AUTHNZ_LDAP#OPTIONS_FILE_SET+=AUTHNZ_LDAP#' /var/db/ports/www_apache${WANT_APACHE_VER}/options
+        ${CMD_SED} -e 's#OPTIONS_FILE_UNSET+=LDAP#OPTIONS_FILE_SET+=LDAP#' /var/db/ports/www_apache${PREFERRED_APACHE_VER}/options
+        ${CMD_SED} -e 's#OPTIONS_FILE_UNSET+=AUTHNZ_LDAP#OPTIONS_FILE_SET+=AUTHNZ_LDAP#' /var/db/ports/www_apache${PREFERRED_APACHE_VER}/options
     elif [ X"${BACKEND}" == X'MYSQL' ]; then
-        ${CMD_SED} -e 's#OPTIONS_FILE_UNSET+=MYSQL#OPTIONS_FILE_SET+=MYSQL#' /var/db/ports/www_apache${WANT_APACHE_VER}/options
+        ${CMD_SED} -e 's#OPTIONS_FILE_UNSET+=MYSQL#OPTIONS_FILE_SET+=MYSQL#' /var/db/ports/www_apache${PREFERRED_APACHE_VER}/options
     elif [ X"${BACKEND}" == X'PGSQL' ]; then
-        ${CMD_SED} -e 's#OPTIONS_FILE_UNSET+=PGSQL#OPTIONS_FILE_SET+=PGSQL#' /var/db/ports/www_apache${WANT_APACHE_VER}/options
+        ${CMD_SED} -e 's#OPTIONS_FILE_UNSET+=PGSQL#OPTIONS_FILE_SET+=PGSQL#' /var/db/ports/www_apache${PREFERRED_APACHE_VER}/options
     fi
-    rm -f /var/db/ports/www_apache${WANT_APACHE_VER}/options${SED_EXTENSION} &>/dev/null
+    rm -f /var/db/ports/www_apache${PREFERRED_APACHE_VER}/options${SED_EXTENSION} &>/dev/null
 
-    ALL_PORTS="${ALL_PORTS} www/apache${WANT_APACHE_VER}"
+    ALL_PORTS="${ALL_PORTS} www/apache${PREFERRED_APACHE_VER}"
 
     # Nginx
     cat > /var/db/ports/www_nginx/options <<EOF