Commits

Zhang Huangbin committed ee85a99

Code cleanup.

  • Participants
  • Parent commits d7d342e

Comments (0)

Files changed (3)

File iRedMail/conf/global

     export LIST_ALL_PKGS="pkg_info | awk '{print $1}'"
     export LIST_FILES_IN_PKG='pkg_info -L'
 
+    # Port directory
+    export PORT_WRKDIRPREFIX='/usr/ports'
+    if [ -f /etc/make.conf ]; then
+        port_dir="$(grep WRKDIRPREFIX /etc/make.conf 2>/dev/null | awk '{print $2}')"
+        [ ! -z ${port_dir} ] && export PORT_WRKDIRPREFIX="${port_dir}"
+    fi
+
     # Service control.
     export enable_service="enable_service_freebsd"
     export disable_service="disable_service_freebsd"

File iRedMail/functions/amavisd.sh

     ECHO_DEBUG "Setting cron job for vmail user to delete virus mail per month."
     cat > ${CRON_SPOOL_DIR}/${AMAVISD_SYS_USER} <<EOF
 ${CONF_MSG}
-# Delete virus mails which created 30 days ago.
-#1   5   *   *   *   find ${AMAVISD_VIRUSMAILS_DIR}/ -ctime +30 | xargs rm -rf {}
+# Delete virus mails which created 15 days ago.
+1   5   *   *   *   find ${AMAVISD_VIRUSMAILS_DIR}/ -ctime +15 | xargs rm -rf {}
 EOF
 
     cat >> ${TIP_FILE} <<EOF

File iRedMail/functions/packages_freebsd.sh

             status="\$status_fetch_port_$portname"
             if [ X"$(eval echo ${status})" != X"DONE" ]; then
                 ECHO_INFO "Fetching required distfiles for port: ${i}"
-                cd /usr/ports/${i}
+                cd ${PORT_WRKDIRPREFIX}/${i}
 
                 # Get time as a UNIX timestamp (seconds elapsed since Jan 1, 1970 0:00 UTC)
                 port_start_time="$(date +%s)"
 
             status="\$status_install_port_$portname"
             if [ X"$(eval echo ${status})" != X"DONE" ]; then
-                cd /usr/ports/${i} && \
+                cd ${PORT_WRKDIRPREFIX}/${i} && \
                     ECHO_INFO "Installing port: ${i} ($(date '+%Y-%m-%d %H:%M:%S')) ..."
                     echo "export status_install_port_${portname}='processing'" >> ${STATUS_FILE}