- OSName=$(uname -s)
- case $OSName in
- Darwin)
- OS=OSX
- __PKG_RID=osx
- ulimit -n 2048
- # Format x.y.z as single integer with three digits for each part
- VERSION=`sw_vers -productVersion| sed -e 's/\./ /g' | xargs printf "%03d%03d%03d"`
- if [ "$VERSION" -lt 010012000 ]; then
- echo error: macOS version `sw_vers -productVersion` is too old. 10.12 is needed as minimum.
- exit 1
- fi
- ;;
- FreeBSD)
- __PKG_RID=freebsd
- OS=FreeBSD
- ;;
- Linux)
- __PKG_RID=linux
- OS=Linux
-
- if [ -e /etc/os-release ]; then
- source /etc/os-release
- if [[ $ID == "alpine" ]]; then
- __PKG_RID=linux-musl
- fi
- elif [ -e /etc/redhat-release ]; then
- redhatRelease=$(</etc/redhat-release)
- if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
- __PKG_RID=rhel.6
- fi
- fi
- OSArch=$(uname -m)
- if [ $OSArch == 'armv7l' ];then
- __PKG_ARCH=arm
- elif [ $OSArch == 'aarch64' ]; then
- __PKG_ARCH=arm64
- fi
-
- ;;
-
- *)
- echo "Unsupported OS '$OSName' detected. Downloading linux-$__PKG_ARCH tools."
- OS=Linux
- __PKG_RID=linux
- ;;
- esac
- __PKG_RID=$__PKG_RID-$__PKG_ARCH
- __DOTNET_PKG=dotnet-sdk-${__DOTNET_TOOLS_VERSION}-$__PKG_RID