Commits

Zhang Huangbin committed 5deb3b2

Drop support for below distributions and releases:
+ Debian 5 (Lenny)
+ Ubuntu 8.x, 9.x, 10.10, 11.04
+ openSUSE: 11.x
+ FreeBSD: 7.x

Comments (0)

Files changed (10)

iRedMail/ChangeLog

 iRedMail-0.8.0-beta3:
+    * Drop support for below distributions and releases:
+        + Debian 5 (Lenny)
+        + Ubuntu 8.x, 9.x, 10.10, 11.04
+        + openSUSE: 11.x
+        + FreeBSD: 7.x
     * Enable greylist opt-in in Policyd-1.x by default.
     * It now works on Ubuntu Linux 12.04 (precise). Tested on Alpha 2.
     * It now works on Linux Mint 12 (code name: lisa).

iRedMail/conf/amavisd

 
     # Override default Amavisd MySQL template file
     # openSUSE-12.1 ships Amavisd-new-2.7.0
-    if [ X"${DISTRO_VERSION}" != X"11.3" -a X"${DISTRO_VERSION}" != X"11.4" ]; then
-        export AMAVISD_DB_MYSQL_TMPL="${SAMPLE_DIR}/amavisd-2.7.0.mysql"
-    fi
+    export AMAVISD_DB_MYSQL_TMPL="${SAMPLE_DIR}/amavisd-2.7.0.mysql"
 
 elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
     export AMAVISD_BIN='/usr/sbin/amavisd-new'

iRedMail/conf/dovecot

     fi
     export DOVECOT_DELIVER='/usr/libexec/dovecot/deliver'
 elif [ X"${DISTRO}" == X"SUSE" ]; then
-    if [ X"${DISTRO_VERSION}" == X"11.1" ]; then
-        # OpenSuSE 11.1 ships dovecot-1.1.x
-        export DOVECOT_VERSION='1.1'
-    else
-        # OpenSuSE 11.2 and later versions ship dovecot-1.2.x
-        export DOVECOT_VERSION='1.2'
-    fi
+    # OpenSuSE 12.1 and later versions ship dovecot-1.2.x
+    export DOVECOT_VERSION='1.2'
 
     export DOVECOT_CONF='/etc/dovecot/dovecot.conf'
     export DOVECOT_LDAP_CONF='/etc/dovecot/dovecot-ldap.conf'
     export DOVECOT_DELIVER='/usr/lib/dovecot/deliver'
 elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
     if [ X"${DISTRO}" == X"DEBIAN" ]; then
-        # Debian 5 (with backports), 6.
         export DOVECOT_VERSION='1.2'
     elif [ X"${DISTRO}" == X"UBUNTU" ]; then
-        if [ X"${DISTRO_CODENAME}" == X"hardy" \
-            -o X"${DISTRO_CODENAME}" == X"intrepid" \
-            -o X"${DISTRO_CODENAME}" == X"jaunty" \
-            -o X"${DISTRO_CODENAME}" == X"karmic" \
-            ]; then
-            export DOVECOT_VERSION='1.1'
-        elif [ X"${DISTRO_CODENAME}" == X"lucid" \
-            -o X"${DISTRO_CODENAME}" == X"natty" \
-            ]; then
-            # Ubuntu 10.04, 10.10, 11.04
+        if [ X"${DISTRO_CODENAME}" == X"lucid" ]; then
+            # Ubuntu 10.04
             export DOVECOT_VERSION='1.2'
         else
             # Ubuntu 11.10+

iRedMail/conf/global

 #   - DISTRO
 #   - DISTRO_VERSION
 #   - DISTRO_CODENAME
+#
+# UNSUPPORTED_RELEASE will be set to 'YES' if current Linux/BSD release is
+# an old release and unsupported anymore.
 if [ X"${KERNEL_NAME}" == X"Linux" ]; then
     # Directory of RC scripts.
     export DIR_RC_SCRIPTS='/etc/init.d'
         # SLES/OpenSuSE
         export DISTRO='SUSE'
 
-        # SuSE version number. e.g. 11.3, 11.4.
+        # SuSE version number. e.g. 12.1
         export DISTRO_VERSION="$(grep 'VERSION' /etc/SuSE-release | awk '{print $3}')"
 
-        # SuSE code name.
+        # code name
         #   - 12.1: asparagus
-        #   - 11.4: celadon
-        #   - 11.3:
         export DISTRO_CODENAME="$(grep 'CODENAME' /etc/SuSE-release | awk '{print $3}' |tr [A-Z] [a-z])"
 
+        # Unsupported releases
+        #   - 11.x
+        #   - 10.x
+        if echo "${DISTRO_VERSION}" | grep '^1[0|1]' &>/dev/null ; then
+            # Both 10.x and 11.x are unsupported
+            export UNSUPPORTED_RELEASE='YES'
+        fi
+
     elif [ -f /etc/lsb-release ]; then
         # Ubuntu
         export DISTRO='UBUNTU'
         # Ubuntu version number. e.g. 11.10.
 
         # Ubuntu version number and code name:
-        #   - 8.04: hardy
-        #   - 8.10: intrepid
-        #   - 9.04: jaunty
-        #   - 9.10: karmic
-        #   - 10.04: lucid
-        #   - 10.10: maverick
-        #   - 11.04: natty
+        #   - 10.04: lucid (Long Term Support by Ubuntu)
         #   - 11.10: oneiric
-        #   - 12.04: precise
+        #   - 12.04: precise (Long Term support by Ubuntu)
         export DISTRO_ID="$(grep 'DISTRIB_ID' /etc/lsb-release | awk -F'=' '{print $2}')"
         export DISTRO_VERSION="$(grep 'DISTRIB_RELEASE' /etc/lsb-release | awk -F'=' '{print $2}')"
         export DISTRO_CODENAME="$(grep 'DISTRIB_CODENAME' /etc/lsb-release | awk -F'=' '{print $2}')"
 
-        # Mark 10.10 (maverick) as 10.04 (lucid).
-        if [ X"${DISTRO_CODENAME}" == X"maverick" ]; then
-            export DISTRO_CODENAME='lucid'
-        fi
-
         # Linux Mint support
         # - 12 (lisa) based on Ubuntu 11.10
         if [ X"${DISTRO_CODENAME}" == X"lisa" ]; then
             export DISTRO_CODENAME="oneiric"
         fi
 
-        # Support PGSQL backend since Ubuntu 11.10.
-        if [ X"${DISTRO_CODENAME}" != X"hardy" \
-            -a X"${DISTRO_CODENAME}" != X"intrepid" \
-            -a X"${DISTRO_CODENAME}" != X"jaunty" \
-            -a X"${DISTRO_CODENAME}" != X"karmic" \
-            -a X"${DISTRO_CODENAME}" != X"lucid" \
-            -a X"${DISTRO_CODENAME}" != X"maverick" \
-            -a X"${DISTRO_CODENAME}" != X"natty" \
-            ]; then
+        # Support PGSQL backend on Ubuntu 11.10 and later releases
+        if [ X"${DISTRO_CODENAME}" != X"lucid" ]; then
             export ENABLE_BACKEND_PGSQL='YES'
         fi
 
+        # Unsupported releases.
+        #   - 8.04: hardy
+        #   - 8.10: intrepid
+        #   - 9.04: jaunty
+        #   - 9.10: karmic
+        #   - 10.10: maverick
+        #   - 11.04: natty
+        if [ X"${DISTRO_CODENAME}" == X'hardy' \
+            -o X"${DISTRO_CODENAME}" == X'intrepid' \
+            -o X"${DISTRO_CODENAME}" == X'jaunty' \
+            -o X"${DISTRO_CODENAME}" == X'karmic' \
+            -o X"${DISTRO_CODENAME}" == X'maverick' \
+            -o X"${DISTRO_CODENAME}" == X'natty' \
+            ]; then
+            export UNSUPPORTED_RELEASE='YES'
+        fi
     elif [ -f /etc/debian_version ]; then
         # Debian
         export DISTRO='DEBIAN'
 
-        # Detect release version: 5.x, 6.x.
-        if grep '^5\.' /etc/debian_version &>/dev/null; then
-            # Debian 5
-            export DISTRO_VERSION='5'
-            export DISTRO_CODENAME='lenny'
-        elif grep '^6\.' /etc/debian_version &>/dev/null; then
-            # Debian 6
-            export DISTRO_VERSION='6'
+        # Get major release version number
+        export DISTRO_VERSION="$(cat /etc/debian_version | cut -b 1)"
+
+        if [ X"${DISTRO_VERSION}" == X'6' ]; then
             export DISTRO_CODENAME='squeeze'
         fi
 
             export SHELL_NOLOGIN='/usr/sbin/nologin'
         fi
 
+        # Unsupported releases
+        # - 4: Etch
+        # - 5: Lenny
+        if [ X"${DISTRO_VERSION}" == X'4' \
+            -o X"${DISTRO_VERSION}" == X'5' \
+            ]; then
+            export UNSUPPORTED_RELEASE='YES'
+        fi
+
     elif [ -f /etc/gentoo-release ]; then
         # Gentoo
         export DISTRO='GENTOO'
 
     # Directory of RC scripts.
     export DIR_RC_SCRIPTS='/usr/local/etc/rc.d'
+
+    # Unsupported releases
+    # - 7.x
+    if echo "${DISTRO_VERSION}" | grep '^7' &>/dev/null ; then
+        export UNSUPPORTED_RELEASE='YES'
+    fi
 else
     # Not support *BSD and other distrobutions yet.
     echo "Error: Your OS is not supported yet."
     exit 255
 fi
 
+# Exit and prompt to use a supported Linux/BSD distribution
+if [ X"${UNSUPPORTED_RELEASE}" == X'YES' ]; then
+    echo "********* ERROR *********"
+    echo "Release version of ${DISTRO} on this server is unsupported by iRedMail,"
+    echo "please refer to below web page to get list of supported versions."
+    echo "http://www.iredmail.org/download.html"
+    echo "********* ERROR *********"
+    exit 255
+fi
+
 # install_pkg: function used to install packages without confirm.
 # remove_pkg: function used to remove packages without confirm.
 # LIST_ALL_PKGS: command used to list all installed packages.
 
     # Syslog config: rsyslog.
     if [ X"${DISTRO}" == X"UBUNTU" ]; then
-        if [ X"${DISTRO_CODENAME}" == X"hardy" \
-            -o X"${DISTRO_CODENAME}" == X"intrepid" \
-            -o X"${DISTRO_CODENAME}" == X"jaunty" ]; then
-            export SYSLOG_CONF='/etc/syslog.conf'
-            export SYSLOG_POSTROTATE_CMD='invoke-rc.d sysklogd reload > /dev/null'
-        else
-            # Ubuntu >= 9.10
-            export SYSLOG_CONF='/etc/rsyslog.d/iredmail.conf'
-            export SYSLOG_POSTROTATE_CMD='reload rsyslog >/dev/null 2>&1 || true'
-        fi
+        # Ubuntu >= 9.10
+        export SYSLOG_CONF='/etc/rsyslog.d/iredmail.conf'
+        export SYSLOG_POSTROTATE_CMD='reload rsyslog >/dev/null 2>&1 || true'
     fi
 
     if [ X"${DISTRO}" == X"DEBIAN" ]; then

iRedMail/functions/apache_php.sh

     #########################################
     # Create ${HTTPD_CONF} or ${HTTPD_SSL_CONF} for special distributions.
     #
-    if [ X"${DISTRO}" == X"UBUNTU" ]; then
-        # Ubuntu (hardy): Generate a sample default-ssl site config file.
-        if [ X"${DISTRO_CODENAME}" == X"hardy" ]; then
-            cat > ${HTTPD_SSL_CONF} <<EOF
-NameVirtualHost *:443
-<VirtualHost *:443>
-    ServerAdmin ${FIRST_USER}@${FIRST_DOMAIN}
-    DocumentRoot ${HTTPD_DOCUMENTROOT}
-
-    # Enable SSL.
-    SSLEngine On
-    SSLCertificateFile ${SSL_CERT_FILE}
-    SSLCertificateKeyFile ${SSL_KEY_FILE}
-</VirtualHost>
-EOF
-        fi
-
-    elif [ X"${DISTRO}" == X"SUSE" ]; then
+    if [ X"${DISTRO}" == X"SUSE" ]; then
         cat > ${HTTPD_CONF} <<EOF
 <VirtualHost *:80>
     ServerAdmin ${FIRST_USER}@${FIRST_DOMAIN}

iRedMail/functions/iredadmin.sh

     chown -R ${IREDADMIN_HTTPD_USER}:${IREDADMIN_HTTPD_GROUP} ${IREDADMIN_HTTPD_ROOT}
     chmod -R 0555 ${IREDADMIN_HTTPD_ROOT}
 
-    if [ X"${DISTRO}" == X"SUSE" ]; then
-        if [ X"${DISTRO_VERSION}" != X"11.3" -a X"${DISTRO_VERSION}" != X"11.4" ]; then
-            # Convert 'TYPE=' to 'ENGINE=' while creating tables.
-            perl -pi -e 's#TYPE=#ENGINE=#g' ${IREDADMIN_HTTPD_ROOT}/docs/samples/iredadmin.sql
-        fi
-    fi
-
+    perl -pi -e 's#TYPE=#ENGINE=#g' ${IREDADMIN_HTTPD_ROOT}/docs/samples/iredadmin.sql
     perl -pi -e 's#TIMESTAMP\(14\)#TIMESTAMP#g' ${IREDADMIN_HTTPD_ROOT}/docs/samples/iredadmin.sql
 
     # Copy sample configure file.

iRedMail/functions/openldap.sh

 
 openldap_data_initialize()
 {
-    if [ X"${DISTRO_CODENAME}" == X"hardy" -a -f /etc/apparmor.d/usr.sbin.slapd ]; then
-        perl -pi -e 's|(})| # Added by $ENV{PROG_NAME}-$ENV{PROG_VERSION}. \n${1}|' /etc/apparmor.d/usr.sbin.slapd
-        perl -pi -e 's#(})# $ENV{LDAP_DATA_DIR}/ r,\n${1}#' /etc/apparmor.d/usr.sbin.slapd
-        perl -pi -e 's#(})# $ENV{LDAP_DATA_DIR}/* rw,\n${1}#' /etc/apparmor.d/usr.sbin.slapd
-        perl -pi -e 's#(})# $ENV{LDAP_DATA_DIR}/alock kw,\n${1}#' /etc/apparmor.d/usr.sbin.slapd
-        [ -x ${DIR_RC_SCRIPTS}/apparmor ] && service_control apparmor restart >/dev/null 2>&1
-    else
-        :
-    fi
-
     # Get DB_CONFIG.example.
     if [ X"${DISTRO}" == X"RHEL" -a X"${DISTRO_VERSION}" == X"6" ]; then
         export OPENLDAP_DB_CONFIG_SAMPLE="$( eval ${LIST_FILES_IN_PKG} openldap-servers | grep '/DB_CONFIG.example$')"

iRedMail/functions/packages.sh

         # Debian.
         ENABLED_SERVICES="rsyslog ${ENABLED_SERVICES}"
     elif [ X"${DISTRO}" == X"UBUNTU" ]; then
-        # Ubuntu.
-        if [ X"${DISTRO_CODENAME}" == X"hardy" \
-            -o X"${DISTRO_CODENAME}" == X"intrepid" \
-            -o X"${DISTRO_CODENAME}" == X"jaunty" ]; then
-            # Ubuntu <= 9.04.
-            ENABLED_SERVICES="sysklogd ${ENABLED_SERVICES}"
-        else
-            # Ubuntu >= 9.10.
-            ENABLED_SERVICES="rsyslog ${ENABLED_SERVICES}"
-        fi
+        # Ubuntu >= 9.10.
+        ENABLED_SERVICES="rsyslog ${ENABLED_SERVICES}"
     elif [ X"${DISTRO}" == X"GENTOO" ]; then
         ENABLED_SERVICES="syslog-ng ${ENABLED_SERVICES}"
         gentoo_add_use_flags 'net-nds/openldap' 'crypt ipv6 ssl tcpd overlays perl sasl syslog'
 
     elif [ X"${DISTRO}" == X"SUSE" ]; then
         ALL_PKGS="${ALL_PKGS} apache2-prefork apache2-mod_php5 php5-iconv php5-ldap php5-mysql php5-mcrypt php5-mbstring php5-gettext php5-dom php5-json php5-intl php5-fileinfo"
-        if [ X"${DISTRO_VERSION}" == X"11.3" -o X"${DISTRO_VERSION}" == X"11.4" ]; then
-            ALL_PKGS="${ALL_PKGS} php5-hash"
-        fi
 
     elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
         ALL_PKGS="${ALL_PKGS} apache2 apache2-mpm-prefork apache2.2-common libapache2-mod-php5 php5-cli php5-imap php5-gd php5-mcrypt php5-mysql php5-ldap php5-pgsql"
         fi
 
         if [ X"${DISTRO_CODENAME}" == X"lucid" \
-            -o X"${DISTRO_CODENAME}" == X"natty" \
             -o X"${DISTRO_CODENAME}" == X"oneiric" \
             -o X"${DISTRO_CODENAME}" == X"precise" \
             ]; then
         ALL_PKGS="${ALL_PKGS} apache2-mod_wsgi python-jinja2 python-mysql python-xml"
 
         # Note: Web.py will be installed locally with command 'easy_install'.
-        if [ X"${DISTRO_VERSION}" == X"11.3" -o X"${DISTRO_VERSION}" == X"11.4" ]; then
-            ALL_PKGS="${ALL_PKGS} python-setuptools"
-        else
-            ALL_PKGS="${ALL_PKGS} python-distribute"
-        fi
+        ALL_PKGS="${ALL_PKGS} python-distribute"
         [ X"${USE_IREDAPD}" != "YES" ] && ALL_PKGS="${ALL_PKGS} python-ldap"
 
     elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
     # Install all packages.
     install_all_pkgs()
     {
-        # Remove 'patterns-openSUSE-minimal_base' on OpenSuSE-11.4 before install.
-        if [ X"${DISTRO}" == X"SUSE" -a X"${DISTRO_VERSION}" == X"11.4" ]; then
-            rpm -e patterns-openSUSE-minimal_base
-        fi
-
         # Install all packages.
         eval ${install_pkg} ${ALL_PKGS}
 

iRedMail/functions/policyd.sh

         orig_policyd_sql_file="$(eval ${LIST_FILES_IN_PKG} ${PKG_POLICYD} | grep '/DATABASE.mysql$')"
 
         # Convert 'TYPE=' to 'ENGINE=' while creating tables.
-        if [ X"${DISTRO}" == X"SUSE" ]; then
-            if [ X"${DISTRO_VERSION}" != X"11.3" -a X"${DISTRO_VERSION}" != X"11.4" ]; then
-                perl -pi -e 's#TYPE=#ENGINE=#g' ${orig_policyd_sql_file}
-            fi
-        fi
+        perl -pi -e 's#TYPE=#ENGINE=#g' ${orig_policyd_sql_file}
 
         cat > ${tmp_sql} <<EOF
 # Import SQL structure template.
 EOF
 
         # Debian 5, Ubuntu 8.04, 9.04: Import missing table: postfixpolicyd.blacklist_dnsname.
-        if [ X"${DISTRO}" == X"DEBIAN" -o \
-            X"${DISTRO_CODENAME}" == X"hardy" -o \
-            X"${DISTRO_CODENAME}" == X"jaunty" ]; then
+        if [ X"${DISTRO}" == X'DEBIAN' ]; then
             cat >> ${tmp_sql} <<EOF
 USE ${POLICYD_DB_NAME};
 SOURCE /usr/share/dbconfig-common/data/postfix-policyd/upgrade/mysql/1.73-1;

iRedMail/pkgs/get_all.sh

 check_user root
 check_hostname
 
-#
-# Mirror site.
-# Site directory structure:
-#
-#   ${MIRROR}/
-#           |- yum/         # for RHEL/CentOS
-#               |- rpms/
-#                   |- 5/
-#                   |- 6/   # Not present yet.
-#               |- misc/    # Source tarballs.
-#               |- srpms/   # Source RPMs.
-#           |- apt/             # for Debian/Ubuntu
-#               |- debian/      # For Debian
-#                   |- lenny/   # For Debian (Lenny)
-#
-# You can find nearest mirror in this page:
-#   http://code.google.com/p/iredmail/wiki/Mirrors
-#
-
 # Where to store binary packages and source tarball.
 PKG_DIR="${ROOTDIR}/pkgs"
 MISC_DIR="${ROOTDIR}/misc"
     if [ X"${PKGLIST}" != X"0" ]; then
         ECHO_INFO "Fetching binary packages ..."
         for i in ${PKGLIST}; do
-            if [ X"${DISTRO}" == X"DEBIAN" ]; then
-                url="${MIRROR}/debian/lenny/${i}"
-            fi
-
             ECHO_INFO "+ ${pkg_counter} of ${pkg_total}: ${url}"
             ${FETCH_CMD} "${url}"
 
 
 }
 
-create_repo_debian()
-{
-    # Use http://backports.debian.org/ on Debian 5.
-    if [ X"${DISTRO}" == X"DEBIAN" -a X"${DISTRO_VERSION}" == X"5" ]; then
-        grep 'Debian-Backports-iRedMail' /etc/apt/sources.list &>/dev/null
-        if [ X"$?" != X"0" ]; then
-            cat >> /etc/apt/sources.list <<EOF
-# Debian-Volatile. Used for updating ClamAV.
-deb http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
-# Debian-Backports-iRedMail
-deb http://backports.debian.org/debian-backports lenny-backports main
-EOF
-
-            cat >> /etc/apt/preferences <<EOF
-
-Package: *
-Pin: release a=lenny-backports
-Pin-Priority: 500
-EOF
-
-            # Force 'apt-get update' to enable backports repo.
-            ECHO_INFO "Execute 'apt-get update' ..."
-            ${APTGET} update
-
-            ${APTGET} install -y debian-archive-keyring
-        fi
-    fi
-}
-
 create_repo_ubuntu()
 {
     if [ X"${DISTRO}" == X"UBUNTU" ]; then
-        if [ X"${DISTRO_CODENAME}" == X"hardy" ]; then
-            # Add ppa repo for Ubuntu 8.04.
-            grep 'Ubuntu-Hardy-PPA-iRedMail' /etc/apt/sources.list &>/dev/null
-            if [ X"$?" != X"0" ]; then
-                # Add repo url.
-                cat >> /etc/apt/sources.list <<EOF
-# Ubuntu-Hardy-PPA-iRedMail
-deb http://ppa.launchpad.net/iredmail/8.04/ubuntu hardy main
-#deb-src http://ppa.launchpad.net/iredmail/8.04/ubuntu hardy main
-EOF
-
-                # Import GPG key.
-                apt-key adv --recv-keys \
-                    --keyserver keyserver.ubuntu.com \
-                    0xd9226c1a29511386b3b9f8bc8dc2c190ddf700d3
-            fi
-        fi
-
         # Force update
         ECHO_INFO "Execute 'apt-get update' ..."
         ${APTGET} update
 elif [ X"${DISTRO}" == X"UBUNTU" ]; then
     create_repo_ubuntu
 elif [ X"${DISTRO}" == X"DEBIAN" ]; then
-    if [ X"${DISTRO_VERSION}" == X"5" ]; then
-        create_repo_debian
-    else
-        # Force update.
-        ECHO_INFO "Execute 'apt-get update' ..."
-        ${APTGET} update
-    fi
+    # Force update.
+    ECHO_INFO "Execute 'apt-get update' ..."
+    ${APTGET} update
 elif [ X"${DISTRO}" == X'GENTOO' ]; then
     # qlist is used to list all installed portages (qlist --installed).
     check_pkg 'qlist' 'portage-utils'