Skip to content

Commit

Permalink
Merge pull request #313 from chef/etc_os_release_version_id
Browse files Browse the repository at this point in the history
Use the VERSION_ID variable by default in /etc/os-release
  • Loading branch information
tas50 authored Mar 12, 2020
2 parents f3c221f + 3fb76d5 commit 4416b76
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ elif test -f "/etc/SuSE-release"; then
then
platform="sles"
platform_version=`awk '/^VERSION/ {V = $3}; /^PATCHLEVEL/ {P = $3}; END {print V "." P}' /etc/SuSE-release`
else
else # opensuse 43 only. 15 ships with /etc/os-release only
platform="opensuseleap"
platform_version=`awk '/^VERSION =/ { print $3 }' /etc/SuSE-release`
fi
Expand All @@ -114,7 +114,14 @@ elif test -f "/etc/os-release"; then
fi

platform=$ID
platform_version=$VERSION

# VERSION_ID is always the preferred variable to use, but not
# every distro has it so fallback to VERSION
if test "x$VERSION_ID" != "x"; then
platform_version=$VERSION_ID
else
platform_version=$VERSION
fi
fi

if test "x$platform" = "x"; then
Expand Down

0 comments on commit 4416b76

Please sign in to comment.