Merge pull request #9552 from id/chore-fix-distro-detection-for-amzn2

chore: fix distro detection for amazon linux 2
This commit is contained in:
Ivan Dyachkov 2022-12-14 19:59:27 +01:00 committed by GitHub
commit 3f058d76b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -14,7 +14,11 @@ case "$UNAME" in
SYSTEM="${DIST}${VERSION_ID}" SYSTEM="${DIST}${VERSION_ID}"
;; ;;
Linux) 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' DIST='el'
VERSION_ID="$(rpm --eval '%{rhel}')" VERSION_ID="$(rpm --eval '%{rhel}')"
else else