Blob Blame History Raw
diff --git a/sapconf b/sapconf
index 5840b2c..97ea301 100644
--- a/sapconf
+++ b/sapconf
@@ -817,6 +817,68 @@ else
 fi
 }
 
+#####################################
+# function: check_glibc
+# parameters: none
+#
+# checks if the minimum version of glibc is installed
+function check_glibc() {
+for GLIBC_PACKAGE in $(rpm -q glibc)
+do
+        REQUIRED_MAJOR_VERSION=2
+        REQUIRED_MINOR_VERSION=17
+        REQUIRED_BUILD_VERSION=73
+        REQUIRED_BUILD_MINOR_VERSION=0
+        ARCHITECTURE=$(echo $GLIBC_PACKAGE | rev | cut -d'.' -f1 | rev)
+        MAJOR_VERSION=$(echo $GLIBC_PACKAGE | cut -d'-' -f2 | cut -d'.' -f1)
+        MINOR_VERSION=$(echo $GLIBC_PACKAGE | cut -d'-' -f2 | cut -d'.' -f2)
+        BUILD_VERSION=$(echo $GLIBC_PACKAGE | cut -d'-' -f3 | cut -d'.' -f1)
+        BUILD_MINOR_VERSION=$(echo $GLIBC_PACKAGE | rev | cut -d'.' -f2- | rev | cut -s -d'_' -f2 | cut -d'.' -f2)
+        UPDATE=0
+
+        if [ -z $BUILD_MINOR_VERSION ]; then
+              BUILD_MINOR_VERSION=0
+        fi
+
+        if [ $MAJOR_VERSION -lt $REQUIRED_MAJOR_VERSION ]; then
+                UPDATE=1
+        elif [ $MAJOR_VERSION -eq $REQUIRED_MAJOR_VERSION ]; then
+                if [ $MINOR_VERSION -lt $REQUIRED_MINOR_VERSION ]; then
+                        UPDATE=1
+                elif [ $MINOR_VERSION -eq $REQUIRED_MINOR_VERSION ]; then
+                        if [ $BUILD_VERSION -lt $REQUIRED_BUILD_VERSION ]; then
+                                UPDATE=1
+                        elif [ $BUILD_VERSION -eq $REQUIRED_BUILD_VERSION ]; then
+                                if [ $BUILD_MINOR_VERSION -lt $REQUIRED_BUILD_MINOR_VERSION ]; then
+                                        UPDATE=1
+                                else
+                                        UPDATE=0
+                                fi
+                        fi
+                fi
+        fi
+
+        if [ $UPDATE -eq 1 ]; then
+                if [ $CHECK_ONLY == 0 ]; then
+                        out "Updating glibc ..."
+                        yum -q -y update "glibc*.$ARCHITECTURE"
+                else
+                        if [ $REQUIRED_BUILD_MINOR_VERSION -eq 0 ]; then
+                                rec "Newer version of glibc is required. Minimum required glibc.$ARCHITECTURE version is glibc-$REQUIRED_MAJOR_VERSION.$REQUIRED_MINOR_VERSION-$REQUIRED_BUILD_VERSION.el7.$ARCHITECTURE."
+                                rec "Installed version is glibc-$MAJOR_VERSION.$MINOR_VERSION-$BUILD_VERSION.el7.$ARCHITECTURE."
+                        else
+                                if [ $BUILD_MINOR_VERSION -eq 0 ]; then
+                                       rec "Newer version of glibc is required. Minimum required glibc.$ARCHITECTURE version is glibc-$REQUIRED_MAJOR_VERSION.$REQUIRED_MINOR_VERSION-$REQUIRED_BUILD_VERSION.el7_0.$REQUIRED_BUILD_MINOR_VERSION.$ARCHITECTURE. Installed version is glibc-$MAJOR_VERSION.$MINOR_VERSION-$BUILD_VERSION.el7.$ARCHITECTURE."
+                                else
+                                       rec "Newer version of glibc is required. Minimum required glibc.$ARCHITECTURE version is glibc-$REQUIRED_MAJOR_VERSION.$REQUIRED_MINOR_VERSION-$REQUIRED_BUILD_VERSION.el7_0.$REQUIRED_BUILD_MINOR_VERSION.$ARCHITECTURE. Installed version is glibc-$MAJOR_VERSION.$MINOR_VERSION-$BUILD_VERSION.el7_0.$BUILD_MINOR_VERSION.$ARCHITECTURE."
+                                fi
+                        fi
+                fi
+        else
+                out "Required glibc.$ARCHITECTURE version is already installed"
+        fi
+done
+}
 
 ####################################################################################
 #
@@ -894,6 +956,7 @@ for g in $SAPGROUPLIST; do
   update_limits_conf @$g hard nofile 32800
   update_limits_conf @$g soft nofile 32800
 done
+check_glibc
 
 out ""
 if [ $CHECK_ONLY == 0 ]; then