# 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