Zhang Huangbin avatar Zhang Huangbin committed dfac982

Still working on DragonFly BSD support.

Comments (0)

Files changed (17)

iRedMail/conf/amavisd

     export AMAVISD_LDAP_SCHEMA_NAME='amavisd-new.schema'
     export AMAVISD_VIRUSMAILS_DIR='/var/virusmails'
 
+    export AMAVISD_SHIPPED_RC_SCRIPT="${DFLY_PKG_RC_SCRIPTS}/amavisd"
+
     # Override location of command 'altermime'
     export ALTERMIME_BIN="${DFLY_PKG_LOCALBASE}/bin/altermime"
 

iRedMail/conf/apache_php

     # PHP
     export PHP_INI="${DFLY_PKG_LOCALBASE}/etc/php.ini"
 
+    export HTTPD_SHIPPED_RC_SCRIPT="${DFLY_PKG_RC_SCRIPTS}/apache"
+
 elif [ X"${DISTRO}" == X"FREEBSD" ]; then
     # Apache configuration files.
     export HTTPD_CONF_ROOT="/usr/local/etc/apache22"

iRedMail/conf/clamav

     export CLAMD_CONF="${DFLY_PKG_LOCALBASE}/etc/clamd.conf"
     export FRESHCLAM_CONF="${DFLY_PKG_LOCALBASE}/etc/freshclam.conf"
 
+    export CLAMD_SHIPPED_RC_SCRIPT="${DFLY_PKG_RC_SCRIPTS}/clamd"
+    export FRESHCLAMD_SHIPPED_RC_SCRIPT="${DFLY_PKG_RC_SCRIPTS}/freshclamd"
+
 elif [ X"${DISTRO}" == X"FREEBSD" ]; then
     export CLAMD_CONF='/usr/local/etc/clamd.conf'
     export FRESHCLAM_CONF='/usr/local/etc/freshclam.conf'

iRedMail/conf/core

         exit 255
     else
         if [ X"$(id -u)" == X"0" ]; then
-            export PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
+            export PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/pkg/sbin:/usr/pkg/bin"
         else
             :
         fi
 install_pkg_dfly()
 {
     ECHO_INFO "Installing package(s): $@"
-    pkg_radd $@
+    /usr/bin/pkg_radd $@
     if [ X"$?" != X"0" ]; then
         ECHO_ERROR "Installation failed, please check the terminal output."
         exit 255

iRedMail/conf/dovecot

     export DOVECOT_DELIVER="${DFLY_PKG_LOCALBASE}/libexec/dovecot/deliver"
 
     export DOVECOT_BIN="${DFLY_PKG_LOCALBASE}/sbin/dovecot"
+
+    export DOVECOT_SHIPPED_RC_SCRIPT="${DFLY_PKG_RC_SCRIPTS}/dovecot"
+
 elif [ X"${DISTRO}" == X"FREEBSD" ]; then
     export DOVECOT_VERSION='1.2'
     export DOVECOT_CONF='/usr/local/etc/dovecot.conf'

iRedMail/conf/global

 # Default virtual domain admin name without domain name (@example.com).
 export DOMAIN_ADMIN_NAME='postmaster'
 
-# Hostname.
-export HOSTNAME="$(hostname -f)"
-
 # ----------------------------------
 # You do *NOT* need to modify them.
 # ----------------------------------
     exit 255
 fi
 
+# Hostname.
+if [ X"${DISTRO}" == X'DFLY' ]; then
+    export HOSTNAME="$(hostname)"
+else
+    export HOSTNAME="$(hostname -f)"
+fi
+
 # Use a seperated directory to store iRedMail certs/keys.
 export SSL_CERT_DIR="${SSL_FILE_DIR}/certs"
 export SSL_KEY_DIR="${SSL_FILE_DIR}/private"
 export MYSQL_BACKUP_DATABASES=''
 
 # Command use to fetch source tarballs.
-if [ X"${DISTRO}" == X"FREEBSD" ]; then
+if [ X"${DISTRO}" == X"FREEBSD" -o X"${DISTRO}" == X'DFLY' ]; then
     # -i: Turns off interactive prompting during multiple file transfers.
     # -V: Disable verbose and progress
     FETCH_CMD='ftp -iV'

iRedMail/conf/openldap

     export OPENLDAP_PID_FILE='/var/openldap/run/slapd.pid'
     export OPENLDAP_ARGS_FILE='/var/openldap/run/slapd.args'
 
+    export OPENLDAP_SHIPPED_RC_SCRIPT="${DFLY_PKG_RC_SCRIPTS}/slapd"
+
 elif [ X"${DISTRO}" == X"FREEBSD" ]; then
     # OpenLDAP version.
     export OPENLDAP_VERSION='2.4'

iRedMail/conf/policyd

     export POLICYD_THROTTLE_CONF="${DFLY_PKG_LOCALBASE}/etc/policyd_sender_throttle.conf"
     export POLICYD_THROTTLE_PIDFILE="/var/run/policyd_sender_throttle.pid"
     export POLICYD_INIT_SCRIPT="${DIR_RC_SCRIPTS}/policyd"
+    export POLICYD_SHIPPED_RC_SCRIPT="${DFLY_PKG_RC_SCRIPTS}/policyd"
 
     # Path of policyd-clean
     export POLICYD_CLEANUP_BIN="${DFLY_PKG_LOCALBASE}/libexec/policyd/cleanup"
 
-    export POLICYD_SHIPPED_RC_SCRIPT="${DFLY_PKG_RC_SCRIPTS}/policyd"
-
 elif [ X"${DISTRO}" == X"FREEBSD" ]; then
     export PKG_POLICYD='postfix-policyd-sf'
     export POLICYD_CONF='/usr/local/etc/postfix-policyd-sf.conf'

iRedMail/conf/postfix

 export POSTFIX_DAEMON_GROUP='postfix'
 
 # Mail log files.
-if [ X"${DISTRO}" == X"RHEL" -o X"${DISTRO}" == X"FREEBSD" ]; then
-    # RHEL, CentOS, FreeBSD
+if [ X"${DISTRO}" == X"RHEL" \
+    -o X"${DISTRO}" == X'DFLY' \
+    -o X"${DISTRO}" == X"FREEBSD" \
+    ]; then
+    # RHEL, CentOS, DragonFly, FreeBSD
     export MAILLOG='/var/log/maillog'
     export MAILLOG_INFO=''
     export MAILLOG_ERROR=''
     export MAILLOG_WARN=''
 fi
 
-if [ X"${DISTRO}" == X"FREEBSD" ]; then
+if [ X"${DISTRO}" == X'DFLY' ]; then
+    export POSTFIX_ROOTDIR="${DFLY_PKG_LOCALBASE}/etc/postfix"
+    export POSTFIX_SHIPPED_RC_SCRIPT="${DFLY_PKG_RC_SCRIPTS}/postfix"
+elif [ X"${DISTRO}" == X"FREEBSD" ]; then
     export POSTFIX_ROOTDIR='/usr/local/etc/postfix'
 else
     export POSTFIX_ROOTDIR='/etc/postfix'

iRedMail/dialog/config_via_dialog.sh

 # Initialize config file.
 echo '' > ${CONFIG_FILE}
 
-if [ X"${DISTRO}" == X"FREEBSD" ]; then
+if [ X"${DISTRO}" == X"FREEBSD" -o X"${DISTRO}" == X'DFLY' ]; then
     DIALOG='dialog'
     PASSWORDBOX='--inputbox'
 else

iRedMail/functions/amavisd.sh

 
 amavisd_config()
 {
+    # DragonFly: Copy rc script
+    if [ X"${DISTRO}" == X'DFLY' ]; then
+        enable_service_dfly amavisd
+        cp ${AMAVISD_SHIPPED_RC_SCRIPT} ${DIR_RC_SCRIPTS}
+    fi
+
     if [ X"${DISTRO}" == X"RHEL" \
         -o X"${DISTRO}" == X'SUSE' \
         -o X"${DISTRO}" == X'GENTOO' \

iRedMail/functions/apache_php.sh

 {
     ECHO_INFO "Configure Apache web server and PHP."
 
+    # DragonFly: Copy rc script.
+    if [ X"${DISTRO}" == X'DFLY' ]; then
+        enable_service_dfly apache
+        cp ${HTTPD_SHIPPED_RC_SCRIPT} ${DIR_RC_SCRIPTS}
+    fi
+
     backup_file ${HTTPD_CONF} ${HTTPD_SSL_CONF}
 
     #########################################

iRedMail/functions/clamav.sh

 {
     ECHO_INFO "Configure ClamAV (anti-virus toolkit)."
 
+    # DragonFly: Copy rc script
+    if [ X"${DISTRO}" == X'DFLY' ]; then
+        enable_service_dfly clamd
+        enable_service_dfly freshclamd
+        cp ${CLAMD_SHIPPED_RC_SCRIPT} ${FRESHCLAMD_SHIPPED_RC_SCRIPT} ${DIR_RC_SCRIPTS}
+    fi
+
     export CLAMD_LOCAL_SOCKET CLAMD_LISTEN_ADDR
     ECHO_DEBUG "Configure ClamAV: ${CLAMD_CONF}."
     perl -pi -e 's/^(TCPSocket.*)/#${1}/' ${CLAMD_CONF}

iRedMail/functions/dovecot2.sh

 {
     ECHO_INFO "Configure Dovecot (pop3/imap server)."
 
+    # DragonFly: Copy rc script
+    if [ X"${DISTRO}" == X'DFLY' ]; then
+        enable_service_dfly dovecot
+        cp ${DOVECOT_SHIPPED_RC_SCRIPT} ${DIR_RC_SCRIPTS}
+    fi
+
     [ X"${ENABLE_DOVECOT}" == X"YES" ] && \
         backup_file ${DOVECOT_CONF} && \
         chmod 0664 ${DOVECOT_CONF} && \

iRedMail/functions/openldap.sh

 {
     ECHO_INFO "Configure OpenLDAP server."
 
+    # DragonFly: Copy rc script
+    if [ X"${DISTRO}" == X'DFLY' ]; then
+        enable_service_dfly slapd
+        cp ${OPENLDAP_SHIPPED_RC_SCRIPT} ${DIR_RC_SCRIPTS}
+    fi
+
     ECHO_DEBUG "Stoping OpenLDAP."
     ${LDAP_INIT_SCRIPT} stop &>/dev/null
 

iRedMail/functions/packages.sh

             # MySQL server and client.
             ALL_PKGS="${ALL_PKGS} mysql"
             ENABLED_SERVICES="${ENABLED_SERVICES} mysql"
-        elif [ X"${DISTRO}" == X"DLY" ]; then
+        elif [ X"${DISTRO}" == X'DFLY' ]; then
             ALL_PKGS="${ALL_PKGS} openldap-server openldap-client 'mysql-server-5.1.*' 'mysql-client-5.1.*'"
             ENABLED_SERVICES="${ENABLED_SERVICES} slapd"
         fi
+
     elif [ X"${BACKEND}" == X"MYSQL" ]; then
         # MySQL server & client.
         if [ X"${DISTRO}" == X"RHEL" ]; then

iRedMail/functions/postfix.sh

 {
     ECHO_INFO "Configure Postfix."
 
+    # DragonFly: Copy rc script
+    if [ X"${DISTRO}" == X'DFLY' ]; then
+        enable_service_dfly postfix
+        cp ${POSTFIX_SHIPPED_RC_SCRIPT} ${DIR_RC_SCRIPTS}
+    fi
+
     backup_file ${POSTFIX_FILE_MAIN_CF} ${POSTFIX_FILE_MASTER_CF}
 
     ECHO_DEBUG "Enable chroot."
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.