浏览代码

chore: fix distro detection for amazon linux 2

Ivan Dyachkov 3 年之前
父节点
当前提交
d8b1809cfc
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      scripts/get-distro.sh

+ 5 - 1
scripts/get-distro.sh

@@ -14,7 +14,11 @@ case "$UNAME" in
         SYSTEM="${DIST}${VERSION_ID}"
         ;;
     Linux)
-        if grep -q -i 'rhel' /etc/*-release; then
+        # /etc/os-release on amazon linux 2 contains both rhel and centos strings
+        if grep -q -i 'amzn' /etc/*-release; then
+            DIST='amzn'
+            VERSION_ID="$(sed -n '/^VERSION_ID=/p' /etc/os-release | sed -r 's/VERSION_ID=(.*)/\1/g' | sed 's/"//g')"
+        elif grep -q -i 'rhel' /etc/*-release; then
             DIST='el'
             VERSION_ID="$(rpm --eval '%{rhel}')"
         else