Commits

Zhang Huangbin committed b5c0f0d

Code cleanup: Get distribution name as DISTRO_CODENAME for RHEL serial distros.

Comments (0)

Files changed (1)

iRedMail/conf/global

         # RHEL/CentOS
         export DISTRO='RHEL'
 
-        # RHEL/CentOS 5.x.
-        grep '\ 5' /etc/redhat-release &>/dev/null
-        if [ X"$?" == X"0" ]; then
+        # Get distribution version
+        if grep '\ 5' /etc/redhat-release &>/dev/null; then
+            # version 5.x
             export DISTRO_VERSION='5'
+        elif grep '\ 6' /etc/redhat-release &>/dev/null; then
+            # version 6.x
+            export DISTRO_VERSION='6'
         fi
 
-        # RHEL/CentOS 6.x.
-        grep '\ 6' /etc/redhat-release &>/dev/null
-        if [ X"$?" == X"0" ]; then
-            export DISTRO_VERSION='6'
+        # Get distribution name as DISTRO_CODENAME
+        if grep '^Red' /etc/redhat-release &>/dev/null; then
+            # RHEL
+            export DISTRO_CODENAME='RHEL'
+        elif grep '^CentOS' /etc/redhat-release &>/dev/null; then
+            # CentOS
+            export DISTRO_CODENAME='CentOS'
+        elif grep '^Scientific' /etc/redhat-release &>/dev/null; then
+            # Scientific Linux
+            export DISTRO_CODENAME='Scientific'
         fi
 
         export PKG_ARCH=".${ARCH}"
         export DISTRO='DEBIAN'
 
         # Detect release version: 5.x, 6.x.
-        # Debian 5.
-        grep '^5\.' /etc/debian_version &>/dev/null
-        if [ X"$?" == X"0" ]; then
+        if grep '^5\.' /etc/debian_version &>/dev/null; then
+            # Debian 5
             export DISTRO_VERSION='5'
             export DISTRO_CODENAME='lenny'
-        fi
-
-        # Debian 6.
-        grep '^6\.' /etc/debian_version &>/dev/null
-        if [ X"$?" == X"0" ]; then
+        elif grep '^6\.' /etc/debian_version &>/dev/null
+            # Debian 6
             export DISTRO_VERSION='6'
             export DISTRO_CODENAME='squeeze'
         fi