Commits

Zhang Huangbin committed 836601a

Improve Gentoo support:
* Don't use Python-3.x (package.mask)
* Configure Amavisd properly

Comments (0)

Files changed (6)

iRedMail/conf/core

     # Check config tool: dialog.
     check_pkg ${BIN_DIALOG} ${PKG_DIALOG}
 
-    ECHO_INFO -n "Check configuration file: ${CONFIG_FILE}..."
+    ECHO_INFO -n "Check configuration file: ${CONFIG_FILE} ..."
     if [ -f ${CONFIG_FILE} ]; then
         grep '^#EOF$' ${CONFIG_FILE} >/dev/null
 
     [ X"$?" != X"0" ] && ECHO_ERROR "Package removed failed, please check the terminal output."
 }
 
-gentoo_mark_package()
+gentoo_mask_package()
 {
     [ -f /etc/portage/package.mask ] || touch /etc/portage/package.mask
     ECHO_DEBUG "Mask packages in /etc/portage/package.mask: $@"
     done
 }
 
-gentoo_unmark_package()
+gentoo_unmask_package()
 {
     [ -f /etc/portage/package.unmask ] || touch /etc/portage/package.unmask
     for pkg in $@; do

iRedMail/conf/global

     export PKG_BZIP2="bzip2"
 
     # Options used for install package
-    export GENTOO_EMERGE_INSTALL_OPTIONS='--buildpkg'
+    export GENTOO_EMERGE_INSTALL_OPTIONS='--buildpkg --quiet-build'
 
 elif [ X"${DISTRO}" == X"FREEBSD" ]; then
     # System user: root.

iRedMail/functions/amavisd.sh

 {
     ECHO_INFO "Configure Amavisd-new (interface between MTA and content checkers)."
 
-    if [ X"${DISTRO}" == X"RHEL" -a X"${DISTRO_VERSION}" == X"6" ]; then
-        usermod -G ${AMAVISD_SYS_GROUP} ${CLAMAV_USER} >/dev/null
+    if [ X"${DISTRO}" == X"RHEL" ]; then
+        [ X"${DISTRO_VERSION}" == X"6" ] && \
+            usermod -G ${AMAVISD_SYS_GROUP} ${CLAMAV_USER} >/dev/null
+    elif [ X"${DISTRO}" == X'GENTOO' ]; then
+        usermod -G ${CLAMAV_GROUP} ${AMAVISD_SYS_USER} >/dev/null
     fi
 
     # Don't check amavisd-milter status.
 
     ECHO_DEBUG "Configure amavisd-new: ${AMAVISD_CONF}."
 
-    #perl -pi -e 's/^(\$max_servers)/$1\ =\ 15\;\t#/' ${AMAVISD_CONF}
-    # ---- Set amavisd daemon user. ----
-    #perl -pi -e 's/^(\$daemon_user)/$1\ =\ "clamav"\;\t#/' ${AMAVISD_CONF}
-    #perl -pi -e 's/^(\$daemon_group)/$1\ =\ "clamav"\;\t#/' ${AMAVISD_CONF}
-
     export FIRST_DOMAIN
     perl -pi -e 's/^(\$mydomain)/$1\ =\ \"$ENV{'HOSTNAME'}\"\;\t#/' ${AMAVISD_CONF}
     perl -pi -e 's/(.*local_domains_maps.*)(].*)/${1},"$ENV{'FIRST_DOMAIN'}"${2}/' ${AMAVISD_CONF}
 
 amavisd_config()
 {
-    if [ X"${DISTRO}" == X"RHEL" -o X"${DISTRO}" == X"FREEBSD" -o X"${DISTRO}" == X"SUSE" ]; then
+    if [ X"${DISTRO}" == X"RHEL" \
+        -o X"${DISTRO}" == X'SUSE' \
+        -o X"${DISTRO}" == X'GENTOO' \
+        -o X"${DISTRO}" == X"FREEBSD" \
+        ]; then
         check_status_before_run amavisd_config_rhel
     elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
         check_status_before_run amavisd_config_debian

iRedMail/functions/cleanup.sh

 cleanup_amavisd_preconfig()
 {
     # Required on Gentoo and FreeBSD to start Amavisd-new.
-    ECHO_INFO "Fetching SpamAssassin rules (sa-update), please wait..."
+    ECHO_INFO "Fetching SpamAssassin rules (sa-update), please wait ..."
     ${BIN_SA_UPDATE} &>/dev/null
 
-    ECHO_INFO "Compiling SpamAssassin rulesets into native code, please be patient..."
+    ECHO_INFO "Compiling SpamAssassin rulesets (sa-compile), please wait ..."
     ${BIN_SA_COMPILE} &>/dev/null
 
     # Update clamav before start clamav-clamd service.
-    ECHO_INFO "Updating ClamAV database..."
+    ECHO_INFO "Updating ClamAV database (freshclam), please wait ..."
     freshclam &>/dev/null
 
     echo 'export status_cleanup_amavisd_preconfig="DONE"' >> ${STATUS_FILE}

iRedMail/functions/packages.sh

         ALL_PKGS="${ALL_PKGS} postfix postfix-pcre"
     elif [ X"${DISTRO}" == X'GENTOO' ]; then
         ALL_PKGS="${ALL_PKGS} postfix"
-        gentoo_unmark_package 'mail-mta/ssmtp'
+        #gentoo_unmask_package 'mail-mta/ssmtp'
         gentoo_add_use_flags 'mail-mta/postfix' 'ipv6 pam ssl cdb dovecot-sasl hardened ldap ldap-bind mbox mysql postgres sasl'
     fi
 
         [ X"${USE_IREDAPD}" != "YES" ] && ALL_PKGS="${ALL_PKGS} python-ldap"
 
         gentoo_add_use_flags 'dev-python/jinja' 'examples i18n vim-syntax'
+        # Don't use python-3
+        gentoo_mask_package '<=dev-lang/python-3.0'
     fi
 
     #############

iRedMail/pkgs/get_all.sh

 EOF
 
             # Force 'apt-get update' to enable backports repo.
-            ECHO_INFO "Execute 'apt-get update'..."
+            ECHO_INFO "Execute 'apt-get update' ..."
             ${APTGET} update
 
             ${APTGET} install -y debian-archive-keyring
         fi
 
         # Force update
-        ECHO_INFO "Execute 'apt-get update'..."
+        ECHO_INFO "Execute 'apt-get update' ..."
         ${APTGET} update
     fi
 }
         create_repo_debian
     else
         # Force update.
-        ECHO_INFO "Execute 'apt-get update'..."
+        ECHO_INFO "Execute 'apt-get update' ..."
         ${APTGET} update
     fi
 elif [ X"${DISTRO}" == X'GENTOO' ]; then