Commits

Zhang Huangbin committed 5ca47c5

Both MySQL and PostgreSQL backends now work on OpenBSD.

Comments (0)

Files changed (5)

iRedMail/conf/dovecot

 export DOVECOT_IMAP_PLUGINS='quota imap_quota autocreate'
 
 # Default quota type: maildir, dict:user::proxy::quotadict (quotadict).
+export DOVECOT_QUOTA_TYPE='dict:user::proxy::quotadict'
 if [ X"${DISTRO}" == X'OPENBSD' ]; then
-    export DOVECOT_QUOTA_TYPE='maildir'
-else
-    export DOVECOT_QUOTA_TYPE='dict:user::proxy::quotadict'
+    if [ X"${BACKEND}" == X'OPENLDAP' ]; then
+        export DOVECOT_QUOTA_TYPE='maildir'
+    fi
 fi
 
 # Do not starts with dot (.).

iRedMail/conf/global

     export SSL_FILE_DIR="/etc/ssl"
 
 elif [ X"${DISTRO}" == X'OPENBSD' ]; then
-    export ENABLE_BACKEND_MYSQL='NO'
-    export ENABLE_BACKEND_PGSQL='NO'
+    export ENABLE_BACKEND_PGSQL='YES'
 
     # System user: root.
     export SYS_ROOT_USER='root'

iRedMail/functions/cleanup.sh

         perl -pi -e 's#^(host.*)ident#${1}md5#' ${PGSQL_CONF_PG_HBA}
     elif [ X"${DISTRO}" == X'UBUNTU' ]; then
         perl -pi -e 's#^(local.*)peer#${1}md5#' ${PGSQL_CONF_PG_HBA}
-    elif [ X"${DISTRO}" == X'FREEBSD' ]; then
+    elif [ X"${DISTRO}" == X'FREEBSD' -o X"${DISTRO}" == X'OPENBSD' ]; then
         # FreeBSD
         perl -pi -e 's#^(local.*)trust#${1}md5#' ${PGSQL_CONF_PG_HBA}
         perl -pi -e 's#^(host.*)trust#${1}md5#' ${PGSQL_CONF_PG_HBA}

iRedMail/functions/packages.sh

             ALL_PKGS="${ALL_PKGS} dovecot-ldap dovecot-mysql"
         elif [ X"${BACKEND}" == X'MYSQL' ]; then
             ALL_PKGS="${ALL_PKGS} dovecot-mysql"
-        elif [ X"${BACKEND}" == X'OPENLDAP' ]; then
+        elif [ X"${BACKEND}" == X'PGSQL' ]; then
             ALL_PKGS="${ALL_PKGS} dovecot-postgresql"
         fi
 
         gentoo_add_use_flags 'net-analyzer/net-snmp' 'bzip2 ipv6 ssl tcpd zlib perl'
 
     elif [ X"${DISTRO}" == X'OPENBSD' ]; then
-        ALL_PKGS="${ALL_PKGS} amavisd-new p5-ldap p5-Mail-SpamAssassin clamav"
+        ALL_PKGS="${ALL_PKGS} amavisd-new p5-ldap p5-DBD-mysql p5-DBD-Pg p5-Mail-SpamAssassin clamav"
         PKG_SCRIPTS="${PKG_SCRIPTS} ${CLAMAV_CLAMD_RC_SCRIPT_NAME} ${CLAMAV_FRESHCLAMD_RC_SCRIPT_NAME} ${AMAVISD_RC_SCRIPT_NAME}"
     fi
 

iRedMail/functions/postgresql.sh

     if [ X"${DISTRO}" == X'FREEBSD' ]; then
         freebsd_enable_service_in_rc_conf 'postgresql_enable' 'YES'
         ${PGSQL_RC_SCRIPT} initdb &>/dev/null
+    elif [ X"${DISTRO}" == X'OPENBSD' ]; then
+        mkdir -p ${PGSQL_DATA_DIR} 2>/dev/null
+        chown ${PGSQL_SYS_USER}:${PGSQL_SYS_GROUP} ${PGSQL_DATA_DIR}
+        su - ${PGSQL_SYS_USER} -c "initdb -D ${PGSQL_DATA_DIR} -U ${PGSQL_SYS_USER} -A trust" >/dev/null
     fi
 
     if [ X"${DISTRO}" == X'RHEL' ]; then