فهرست منبع

AMBARI-4101. OS version checking incorrectly reports "centos5" when os is centos 6.5. (Dmytro Shkvyra via odiachenko)

Oleksandr Diachenko 11 سال پیش
والد
کامیت
35196a776a
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      ambari-server/src/main/python/os_type_check.sh

+ 3 - 2
ambari-server/src/main/python/os_type_check.sh

@@ -32,8 +32,8 @@ pattern='[^[:digit:]]*'
 # OS type detection
 # OS type detection
 if [ -f  "/etc/centos-release" ] 
 if [ -f  "/etc/centos-release" ] 
 then
 then
-  grep -qE "${pattern}6" /etc/centos-release && current_os=$C6
-  grep -qE "${pattern}5" /etc/centos-release && current_os=$C5
+  grep -sqiE "^centos ${pattern}6" /etc/centos-release && current_os=$C6
+  grep -sqiE "^centos ${pattern}5" /etc/centos-release && current_os=$C5
 elif [ -f  "/etc/oracle-release" ] || [ -f  "/etc/ovs-release" ] || [ -f  "/etc/enterprise-release" ] 
 elif [ -f  "/etc/oracle-release" ] || [ -f  "/etc/ovs-release" ] || [ -f  "/etc/enterprise-release" ] 
 then
 then
   grep -sqE "${pattern}6" /etc/oracle-release || grep -sqE "${pattern}6" /etc/ovs-release || \
   grep -sqE "${pattern}6" /etc/oracle-release || grep -sqE "${pattern}6" /etc/ovs-release || \
@@ -43,6 +43,7 @@ then
 elif [ -f  "/etc/redhat-release" ]
 elif [ -f  "/etc/redhat-release" ]
 then
 then
   grep -sqiE "^centos ${pattern}5" /etc/redhat-release && current_os=$C5
   grep -sqiE "^centos ${pattern}5" /etc/redhat-release && current_os=$C5
+  grep -sqiE "^centos ${pattern}6" /etc/redhat-release && current_os=$C6
   grep -sqE "^Red Hat Enterprise Linux ${pattern}6" /etc/redhat-release && current_os=$RH6
   grep -sqE "^Red Hat Enterprise Linux ${pattern}6" /etc/redhat-release && current_os=$RH6
   grep -sqE "^Red Hat Enterprise Linux ${pattern}5" /etc/redhat-release && current_os=$RH5
   grep -sqE "^Red Hat Enterprise Linux ${pattern}5" /etc/redhat-release && current_os=$RH5
 elif [ -f  "/etc/SuSE-release" ]
 elif [ -f  "/etc/SuSE-release" ]