Commits

Zhang Huangbin  committed 635eb8e

Use EPEL yum repo on RHEL/CentOS 6 by default, but not on RHEL/CentOS 5.

  • Participants
  • Parent commits 281ab59

Comments (0)

Files changed (7)

File iRedMail/ChangeLog

 iRedMail-0.8.5:
+    * Use EPEL yum repo on RHEL/CentOS 6 by default, but not on RHEL/CentOS 5.
     * Update SQL triggers to insert value for column 'used_quota.domain'
       automatically.
     * Install php53 from vender official yum repo on RHEL/CentOS 5.

File iRedMail/conf/awstats

 # Config files.
 if [ X"${DISTRO}" == X"RHEL" ]; then
     export AWSTATS_CONF_SAMPLE="${AWSTATS_CONF_DIR}/awstats.localhost.localdomain.conf"
-    export AWSTATS_HTTPD_ROOT="${HTTPD_SERVERROOT}/awstats"
-    export AWSTATS_CGI_DIR="${AWSTATS_HTTPD_ROOT}"
+    if [ X"${DISTRO_VERSION}" == X'5' ]; then
+        export AWSTATS_HTTPD_ROOT="${HTTPD_SERVERROOT}/awstats"
+        export AWSTATS_CGI_DIR="${AWSTATS_HTTPD_ROOT}"
+    else
+        export AWSTATS_HTTPD_ROOT="/usr/share/awstats/wwwroot"
+        export AWSTATS_CGI_DIR="${AWSTATS_HTTPD_ROOT}/cgi-bin"
+    fi
     export AWSTATS_ICON_DIR="${AWSTATS_HTTPD_ROOT}/icon"
     export AWSTATS_CSS_DIR="${AWSTATS_HTTPD_ROOT}/css"
     export AWSTATS_JS_DIR="${AWSTATS_HTTPD_ROOT}/js"

File iRedMail/conf/clamav

 
 # Clamav.
 if [ X"${DISTRO}" == X"RHEL" ]; then
+    if [ X"${DISTRO_VERSION}" != X'5' [; then
+        export CLAMAV_USER='clam'
+        export CLAMAV_GROUP='clam'
+    fi
     # Freshclam.
     export FRESHCLAM_INIT_FILE_SAMPLE="${SAMPLE_DIR}/freshclam.init"
 

File iRedMail/conf/core

 install_pkg_rhel()
 {
     ECHO_INFO "Installing package(s): $@"
-    ${YUM} -y --disablerepo=epel,rpmforge,ius install $@
+    ${YUM} -y --disablerepo=rpmforge,ius install $@
     if [ X"$?" != X"0" ]; then
         ECHO_ERROR "Installation failed, please check the terminal output."
         ECHO_ERROR "If you're not sure what the problem is, try to get help in iRedMail"

File iRedMail/functions/clamav.sh

     perl -pi -e 's/^#(OfficialDatabaseOnly ).*/${1} yes/' ${CLAMD_CONF}
 
     if [ X"${DISTRO}" == X"RHEL" ]; then
+        if [ X"${DISTRO_VERSION}" != X'5' ]; then
+            ECHO_DEBUG "Add clamav user to amavid group."
+            usermod ${CLAMAV_USER} -G ${AMAVISD_SYS_GROUP}
+
+            ECHO_DEBUG "Set permission to 750: ${AMAVISD_TEMPDIR}, ${AMAVISD_QUARANTINEDIR},"
+            chmod -R 750 ${AMAVISD_TEMPDIR} ${AMAVISD_QUARANTINEDIR}
+        fi
+
         ECHO_DEBUG "Copy freshclam init startup script and enable it."
         cp -f ${FRESHCLAM_INIT_FILE_SAMPLE} /etc/rc.d/init.d/freshclam
         chmod +x /etc/rc.d/init.d/freshclam

File iRedMail/functions/packages.sh

     # Amavisd-new & ClamAV & Altermime.
     ENABLED_SERVICES="${ENABLED_SERVICES} ${CLAMAV_CLAMD_RC_SCRIPT_NAME} ${AMAVISD_RC_SCRIPT_NAME}"
     if [ X"${DISTRO}" == X"RHEL" ]; then
-        ALL_PKGS="${ALL_PKGS} clamd${PKG_ARCH} clamav${PKG_ARCH} clamav-db${PKG_ARCH} spamassassin${PKG_ARCH} altermime${PKG_ARCH} perl-LDAP.noarch perl-Mail-SPF.noarch perl-Mail-SPF-Query.noarch"
+        ALL_PKGS="${ALL_PKGS} clamd${PKG_ARCH} clamav${PKG_ARCH} clamav-db${PKG_ARCH} spamassassin${PKG_ARCH} altermime${PKG_ARCH} perl-LDAP.noarch perl-Mail-SPF.noarch"
 
         if [ X"${DISTRO_VERSION}" == X"5" ]; then
             ALL_PKGS="${ALL_PKGS} amavisd-new${PKG_ARCH} perl-IO-Compress.noarch"

File iRedMail/pkgs/get_all.sh

 EOF
     fi
 
+    ECHO_INFO "Clean metadata of yum repositories."
+    yum clean metadata
+
+    # RHEL/CentOS 6 only. EPEL for RHEL 5 is out of date.
+    # Create a temporary yum repo to install epel-release without GPG check.
+    if [ X"${DISTRO_VERSION}" == X'6' ]; then
+        cat > ${YUM_REPOS_DIR}/tmp_epel.repo <<EOF
+[tmp_epel]
+name=Extra Packages for Enterprise Linux ${DISTRO_VERSION} - \$basearch
+#baseurl=http://download.fedoraproject.org/pub/epel/${DISTRO_VERSION}/\$basearch
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-${DISTRO_VERSION}&arch=\$basearch
+failovermethod=priority
+enabled=1
+gpgcheck=0
+EOF
+        ECHO_INFO "Install epel yum repo."
+        eval ${install_pkg} epel-release && rm ${YUM_REPOS_DIR}/tmp_epel.repo
+        yum clean metadata
+    fi
+
     echo 'export status_create_yum_repo="DONE"' >> ${STATUS_FILE}
 }
 
 prepare_dirs
 
 if [ X"${DISTRO}" == X"RHEL" ]; then
-    # Clean metadata
-    ECHO_INFO "Clean metadata of yum repositories."
-    yum clean metadata
-
     # Create yum repository.
     create_repo_rhel