Commits

Zhang Huangbin committed 01ce86a

Working on iRedAPD-1.4.0 support.

Comments (0)

Files changed (7)

iRedMail/conf/iredapd

 
 export USE_IREDAPD='YES'
 
-export IREDAPD_VERSION='1.3.8'
+export IREDAPD_VERSION='1.4.0'
 export IREDAPD_DAEMON_USER='iredapd'
 export IREDAPD_DAEMON_GROUP='iredapd'
 export IREDAPD_HOME_DIR='/home/iredapd'
 
 export IREDAPD_PID_FILE='/var/run/iredapd.pid'
 export IREDAPD_LOG_FILE='/var/log/iredapd.log'
-export IREDAPD_RR_PID_FILE='/var/run/iredapd-rr.pid'
-export IREDAPD_RR_LOG_FILE='/var/log/iredapd-rr.log'
 export IREDAPD_LOGROTATE_FILE="${LOGROTATE_DIR}/iredapd"

iRedMail/functions/iredapd.sh

     elif [ X"${DISTRO}" == X"SUSE" ]; then
         cp ${IREDAPD_ROOT_DIR}/iredapd/rc_scripts/iredapd.opensuse ${DIR_RC_SCRIPTS}/iredapd
     elif [ X"${DISTRO}" == X"GENTOO" ]; then
-        cp ${SAMPLE_DIR}/gentoo.iredapd.runscript ${DIR_RC_SCRIPTS}/iredapd
-        chmod +x ${DIR_RC_SCRIPTS}/iredapd
+        cp ${IREDAPD_ROOT_DIR}/iredapd/rc_scripts/iredapd.gentoo ${DIR_RC_SCRIPTS}/iredapd
     elif [ X"${DISTRO}" == X"FREEBSD" ]; then
         cp ${IREDAPD_ROOT_DIR}/iredapd/rc_scripts/iredapd.freebsd ${DIR_RC_SCRIPTS}/iredapd
     elif [ X"${DISTRO}" == X'OPENBSD' ]; then
-        # Create rc script
-        cat > ${DIR_RC_SCRIPTS}/iredapd <<EOF
-#!/bin/sh
-daemon='python ${IREDAPD_ROOT_DIR}/iredapd/src/iredapd.py ${IREDAPD_ROOT_DIR}/iredapd/etc/iredapd.ini'
-
-. /etc/rc.d/rc.subr
-
-rc_reload=NO
-rc_cmd \$1
-EOF
-
-        cat > ${DIR_RC_SCRIPTS}/iredapd-rr <<EOF
-#!/bin/sh
-daemon='python ${IREDAPD_ROOT_DIR}/iredapd/src/iredapd-rr.py ${IREDAPD_ROOT_DIR}/iredapd/etc/iredapd-rr.ini'
-
-. /etc/rc.d/rc.subr
-
-rc_reload=NO
-rc_cmd \$1
-EOF
-
-        chmod 0755 ${DIR_RC_SCRIPTS}/iredapd-rr
+        cp ${IREDAPD_ROOT_DIR}/iredapd/rc_scripts/iredapd.openbsd ${DIR_RC_SCRIPTS}/iredapd
     else
         cp ${IREDAPD_ROOT_DIR}/iredapd/rc_scripts/iredapd.rhel ${DIR_RC_SCRIPTS}/iredapd
     fi
 
     chmod 0755 ${DIR_RC_SCRIPTS}/iredapd
-    chmod +x ${IREDAPD_ROOT_DIR}/iredapd/src/iredapd.py
 
     ECHO_DEBUG "Make iredapd start after system startup."
     eval ${enable_service} iredapd &>/dev/null
 
     # Set file permission.
     chown -R ${IREDAPD_DAEMON_USER}:${IREDAPD_DAEMON_USER} ${IREDAPD_ROOT_DIR}/iRedAPD-${IREDAPD_VERSION}
-    chmod -R 0755 ${IREDAPD_ROOT_DIR}/iRedAPD-${IREDAPD_VERSION}
+    chmod -R 0555 ${IREDAPD_ROOT_DIR}/iRedAPD-${IREDAPD_VERSION}
 
     # Copy sample config file.
-    cd ${IREDAPD_ROOT_DIR}/iredapd/etc/
-    cp iredapd.ini.sample iredapd.ini
-    chmod -R 0500 iredapd.ini
+    cd ${IREDAPD_ROOT_DIR}/iredapd/
+    cp settings.py.sample settings.py
+    chmod -R 0500 settings.py
 
-    # Config iredapd.
-    perl -pi -e 's#^(listen_addr).*#${1} = $ENV{IREDAPD_BIND_HOST}#' iredapd.ini
-    perl -pi -e 's#^(listen_port).*#${1} = $ENV{IREDAPD_LISTEN_PORT}#' iredapd.ini
+    # General settings.
+    perl -pi -e 's#^(listen_address).*#${1} = "$ENV{IREDAPD_BIND_HOST}"#' settings.py
+    perl -pi -e 's#^(listen_port).*#${1} = "$ENV{IREDAPD_LISTEN_PORT}"#' settings.py
+    perl -pi -e 's#^(run_as_user).*#${1} = "$ENV{IREDAPD_DAEMON_USER}"#' settings.py
+    perl -pi -e 's#^(log_level).*#${1} = "info"#' settings.py
 
-    perl -pi -e 's#^(run_as_user).*#${1} = $ENV{IREDAPD_DAEMON_USER}#' iredapd.ini
-    perl -pi -e 's#^(run_as_daemon).*#${1} = yes#' iredapd.ini
+    # Backend.
+    [ X"${BACKEND}" == X'OPENLDAP' ] && perl -pi -e 's#^(backend).*#${1} = "ldap"#' settings.py
+    [ X"${BACKEND}" == X'MYSQL' ] && perl -pi -e 's#^(backend).*#${1} = "mysql"#' settings.py
+    [ X"${BACKEND}" == X'PGSQL' ] && perl -pi -e 's#^(backend).*#${1} = "pgsql"#' settings.py
 
-    perl -pi -e 's#^(log_level).*#${1} = info#' iredapd.ini
+    # Backend related parameters.
+    if [ X"${BACKEND}" == X'OPENLDAP' ]; then
+        perl -pi -e 's#^(ldap_uri).*#${1} = "ldap://$ENV{LDAP_SERVER_HOST}:$ENV{LDAP_SERVER_PORT}"#' settings.py
+        perl -pi -e 's#^(ldap_binddn).*#${1} = "$ENV{LDAP_BINDDN}"#' settings.py
+        perl -pi -e 's#^(ldap_bindpw).*#${1} = "$ENV{LDAP_BINDPW}"#' settings.py
+        perl -pi -e 's#^(ldap_basedn).*#${1} = "$ENV{LDAP_BASEDN}"#' settings.py
 
-    if [ X"${BACKEND}" == X"OPENLDAP" ]; then
-        # Set backend.
-        perl -pi -e 's#^(backend).*#${1} = ldap#' iredapd.ini
-
-        # Configure OpenLDAP server related stuffs.
-        perl -pi -e 's#^(uri).*#${1} = ldap://$ENV{LDAP_SERVER_HOST}:$ENV{LDAP_SERVER_PORT}#' iredapd.ini
-        perl -pi -e 's#^(binddn).*#${1} = $ENV{LDAP_BINDDN}#' iredapd.ini
-        perl -pi -e 's#^(bindpw).*#${1} = $ENV{LDAP_BINDPW}#' iredapd.ini
-        perl -pi -e 's#^(basedn).*#${1} = $ENV{LDAP_BASEDN}#' iredapd.ini
-
-        # Enable plugins.
-        perl -pi -e 's#^(plugins).*#${1} = ldap_maillist_access_policy, block_amavisd_blacklisted_senders#' iredapd.ini
+        perl -pi -e 's#^(plugins).*#${1} = ["ldap_maillist_access_policy", "ldap_amavisd_block_blacklisted_senders"]#' settings.py
 
     elif [ X"${BACKEND}" == X"MYSQL" -o X"${BACKEND}" == X'PGSQL' ]; then
-        # Set backend.
-        if [ X"${BACKEND}" == X'MYSQL' ]; then
-            perl -pi -e 's#^(backend).*#${1} = mysql#' iredapd.ini
-        else
-            perl -pi -e 's#^(backend).*#${1} = pgsql#' iredapd.ini
-        fi
+        perl -pi -e 's#^(sql_server).*#${1} = "$ENV{SQL_SERVER}"#' settings.py
+        perl -pi -e 's#^(sql_port).*#${1} = "$ENV{SQL_SERVER_PORT}"#' settings.py
+        perl -pi -e 's#^(sql_db).*#${1} = "$ENV{VMAIL_DB}"#' settings.py
+        perl -pi -e 's#^(sql_user).*#${1} = "$ENV{VMAIL_DB_BIND_USER}"#' settings.py
+        perl -pi -e 's#^(sql_password).*#${1} = "$ENV{VMAIL_DB_BIND_PASSWD}"#' settings.py
 
-        # Configure MySQL server related stuffs.
-        perl -pi -e 's#^(server).*#${1} = $ENV{SQL_SERVER}#' iredapd.ini
-        perl -pi -e 's#^(port).*#${1} = $ENV{SQL_SERVER_PORT}#' iredapd.ini
-        perl -pi -e 's#^(db).*#${1} = $ENV{VMAIL_DB}#' iredapd.ini
-        perl -pi -e 's#^(user).*#${1} = $ENV{VMAIL_DB_BIND_USER}#' iredapd.ini
-        perl -pi -e 's#^(password).*#${1} = $ENV{VMAIL_DB_BIND_PASSWD}#' iredapd.ini
-
-        # Enable plugins.
-        perl -pi -e 's#^(plugins).*#${1} = sql_alias_access_policy#' iredapd.ini
+        perl -pi -e 's#^(plugins).*#${1} = ["sql_alias_access_policy"]#' settings.py
     fi
 
     # FreeBSD: Start iredapd when system start up.
     freebsd_enable_service_in_rc_conf 'iredapd_enable' 'YES'
 
+    # Log rotate
     if [ X"${KERNEL_NAME}" == X'LINUX' ]; then
         ECHO_DEBUG "Setting logrotate for iRedAPD log file."
         cat > ${IREDAPD_LOGROTATE_FILE} <<EOF
 ${CONF_MSG}
-${IREDAPD_LOG_FILE} ${IREDAPD_RR_LOG_FILE} {
+${IREDAPD_LOG_FILE}
     compress
     weekly
     rotate 10
     * Related files:
         - ${IREDAPD_ROOT_DIR}/iRedAPD-${IREDAPD_VERSION}/
         - ${IREDAPD_ROOT_DIR}/iredapd/
-        - ${IREDAPD_ROOT_DIR}/iredapd/etc/iredapd.ini
+        - ${IREDAPD_ROOT_DIR}/iredapd/etc/settings.py
 EOF
 
     echo 'export status_iredapd_config="DONE"' >> ${STATUS_FILE}

iRedMail/pkgs/MD5.debian.squeeze

 9cf2f112877cb04647b69b00edccdc4e  misc/iRedAdmin-0.2.tar.bz2
 2f578c8c4741bfc43d9188923c06b638  misc/roundcubemail-0.8.4.tar.gz
-6ba17a1379b612838d691d7366e867db  misc/iRedAPD-1.3.8.tar.bz2
+76c323deea80b4260c07586d175c944a  misc/iRedAPD-1.4.0.tar.bz2
 ea3030b376d389bbe447f88dfaf832f2  misc/phpPgAdmin-5.0.4.tar.bz2

iRedMail/pkgs/MD5.misc

 2f578c8c4741bfc43d9188923c06b638  misc/roundcubemail-0.8.4.tar.gz
 78ca61eb5d7913963f8e42eb3b4f0e95  misc/phpldapadmin-1.2.2.tgz
 3f77e1a608939224a7dce97caf860f46  misc/phpMyAdmin-3.5.5-all-languages.tar.bz2
-6ba17a1379b612838d691d7366e867db  misc/iRedAPD-1.3.8.tar.bz2
+76c323deea80b4260c07586d175c944a  misc/iRedAPD-1.4.0.tar.bz2
 ea3030b376d389bbe447f88dfaf832f2  misc/phpPgAdmin-5.0.4.tar.bz2

iRedMail/pkgs/MD5.openbsd

 9cf2f112877cb04647b69b00edccdc4e  misc/iRedAdmin-0.2.tar.bz2
-6ba17a1379b612838d691d7366e867db  misc/iRedAPD-1.3.8.tar.bz2
+76c323deea80b4260c07586d175c944a  misc/iRedAPD-1.4.0.tar.bz2

iRedMail/pkgs/SHASUM.freebsd.misc

 509b1d65c166887e5a07e319a013c9f28380a792  misc/iRedAdmin-0.2.tar.bz2
-f41c0b1b4e3ec3cab5fa88d52c05d7d92a61943d  misc/iRedAPD-1.3.8.tar.bz2
+42361e401220a945a117d8b280e0a490f63b6df7  misc/iRedAPD-1.4.0.tar.bz2

iRedMail/samples/gentoo.iredapd.runscript

-#!/sbin/runscript
-
-prog='/opt/iredapd/src/iredapd.py'
-progname="iRedAPD"
-
-CONFIG='/opt/iredapd/etc/iredapd.ini'
-PIDFILE='/var/run/iredapd.pid'
-
-depend() {
-	before mta
-    after mysql slapd
-}
-
-start() {
-    ebegin "Starting ${SVCNAME}"
-    start-stop-daemon --start \
-        --exec python ${prog} ${CONFIG}
-
-    eend $?
-}
-
-stop() {
-    ebegin "Stopping ${SVCNAME}"
-    start-stop-daemon --stop --pidfile ${PIDFILE}
-    rm -f ${PIDFILE}
-    eend $?
-}
-
-restart() {
-    ebegin "Restarting ${SVCNAME}"
-    svc_stop
-    sleep 3
-    svc_start
-    eend $?
-}
-