From 13593513cbabfc4cbbb50e62bedbe0ce6f93488a Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Mon, 12 Dec 2016 14:40:55 -0800 Subject: [PATCH] Only consider /etc/os-release for distro info This is in line with how the `dotnet` tooling works. --- init-tools.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/init-tools.sh b/init-tools.sh index 9a83bda189..9a5c8b32b2 100755 --- a/init-tools.sh +++ b/init-tools.sh @@ -18,45 +18,45 @@ __INIT_TOOLS_DONE_MARKER=$__PROJECT_JSON_PATH/done # Extended version of platform detection logic from dotnet/cli/scripts/obtain/dotnet-install.sh 16692fc get_current_linux_name() { # Detect Distro - if [ "$(cat /etc/*-release | grep -cim1 ubuntu)" -eq 1 ]; then - if [ "$(cat /etc/*-release | grep -cim1 16.04)" -eq 1 ]; then + if [ "$(cat /etc/os-release | grep -cim1 ubuntu)" -eq 1 ]; then + if [ "$(cat /etc/os-release | grep -cim1 16.04)" -eq 1 ]; then echo "ubuntu.16.04" return 0 fi - if [ "$(cat /etc/*-release | grep -cim1 16.10)" -eq 1 ]; then + if [ "$(cat /etc/os-release | grep -cim1 16.10)" -eq 1 ]; then echo "ubuntu.16.10" return 0 fi echo "ubuntu" return 0 - elif [ "$(cat /etc/*-release | grep -cim1 centos)" -eq 1 ]; then + elif [ "$(cat /etc/os-release | grep -cim1 centos)" -eq 1 ]; then echo "centos" return 0 - elif [ "$(cat /etc/*-release | grep -cim1 rhel)" -eq 1 ]; then + elif [ "$(cat /etc/os-release | grep -cim1 rhel)" -eq 1 ]; then echo "rhel" return 0 - elif [ "$(cat /etc/*-release | grep -cim1 debian)" -eq 1 ]; then + elif [ "$(cat /etc/os-release | grep -cim1 debian)" -eq 1 ]; then echo "debian" return 0 - elif [ "$(cat /etc/*-release | grep -cim1 alpine)" -eq 1 ]; then + elif [ "$(cat /etc/os-release | grep -cim1 alpine)" -eq 1 ]; then echo "alpine" return 0 - elif [ "$(cat /etc/*-release | grep -cim1 fedora)" -eq 1 ]; then - if [ "$(cat /etc/*-release | grep -cim1 23)" -eq 1 ]; then + elif [ "$(cat /etc/os-release | grep -cim1 fedora)" -eq 1 ]; then + if [ "$(cat /etc/os-release | grep -cim1 23)" -eq 1 ]; then echo "fedora.23" return 0 fi - if [ "$(cat /etc/*-release | grep -cim1 24)" -eq 1 ]; then + if [ "$(cat /etc/os-release | grep -cim1 24)" -eq 1 ]; then echo "fedora.24" return 0 fi - elif [ "$(cat /etc/*-release | grep -cim1 opensuse)" -eq 1 ]; then - if [ "$(cat /etc/*-release | grep -cim1 13.2)" -eq 1 ]; then + elif [ "$(cat /etc/os-release | grep -cim1 opensuse)" -eq 1 ]; then + if [ "$(cat /etc/os-release | grep -cim1 13.2)" -eq 1 ]; then echo "opensuse.13.2" return 0 fi - if [ "$(cat /etc/*-release | grep -cim1 42.1)" -eq 1 ]; then + if [ "$(cat /etc/os-release | grep -cim1 42.1)" -eq 1 ]; then echo "opensuse.42.1" return 0 fi -- 2.34.1