@@ -20,23 +20,61 @@ if [ -z $INSTALLPATH ]; then
2020 INSTALLPATH=/usr/share/dotnet
2121fi
2222
23+ # **************** definition of variables ****************
24+ declare ARCH_OS=$( uname -m) # aarch64, armv7l, x86_64 or riscv64
25+ declare ID_OS=(" $( cat /etc/* release | grep ' ^ID=' | sed ' s/.*=\s*//' ) " ) # ubuntu, debian, alpine
26+ declare VERSION_OS=(" $( cat /etc/* release | grep ' ^VERSION_ID=' | sed ' s/.*=\s*//' ) " )
27+ VERSION_OS=(" $( echo ${VERSION_OS} | sed ' s/\"//g' ) " )
28+ # get only type XX.YY
29+ VERSION_OS=(" $( cut -d ' .' -f 1 <<< " $VERSION_OS" ) " ." $( cut -d ' .' -f 2 <<< " $VERSION_OS" ) " )
30+
31+ # requirements check
32+ if [ $ARCH_OS != " aarch64" ] && [ $ARCH_OS != " armv7l" ] \
33+ && [ $ARCH_OS != " x86_64" ]&& [ $ARCH_OS != " riscv64" ]; then
34+ echo " ERROR. Current OS architecture ${ARCH_OS} is not supported."
35+ exit 1;
36+ fi
37+
38+ if [ $ID_OS != " ubuntu" ] && [ $ID_OS != " debian" ] && [ $ID_OS != " alpine" ]; then
39+ echo " ERROR. Current OS ${ID_OS} not supported."
40+ exit 1;
41+ fi
42+
2343export DEBIAN_FRONTEND=" noninteractive"
2444
2545sudo apt-get update
2646sudo apt-get install -y wget
2747
28- # install
29- wget https://dot.net/v1/dotnet-install.sh
30- sudo chmod +x dotnet-install.sh
31- export DOTNET_CLI_TELEMETRY_OPTOUT=true
32- sudo ./dotnet-install.sh --channel $NETSDK_CHANNEL --install-dir $INSTALLPATH
48+ # for aarch64, armv7l, x86_64
49+ if [ $ARCH_OS == " aarch64" ] && [ $ARCH_OS == " armv7l" ] \
50+ && [ $ARCH_OS == " x86_64" ]; then
51+ # install
52+ wget https://dot.net/v1/dotnet-install.sh
53+ sudo chmod +x dotnet-install.sh
54+ export DOTNET_CLI_TELEMETRY_OPTOUT=true
55+ sudo ./dotnet-install.sh --channel $NETSDK_CHANNEL --install-dir $INSTALLPATH
56+ rm dotnet-install.sh
57+ fi
58+
59+ # for riscv64
60+ if [ $ARCH_OS == " riscv64" ]; then
61+ if [ $NETSDK_CHANNEL != " 8.0" ]; then
62+ echo " ERROR. You can only install dotnet sdk 8.0 for riscv64."
63+ exit 1;
64+ fi
65+ sudo apt-get install -y tar
66+ wget -O dotnet-sdk-riscv64.tar.gz " https://github.com/dkurt/dotnet_riscv/releases/download/v8.0.100/dotnet-sdk-8.0.100-linux-riscv64.tar.gz"
67+ sudo mkdir -p $INSTALLPATH
68+ sudo tar -xf dotnet-sdk-riscv64.tar.gz -C " $INSTALLPATH " --checkpoint=.100
69+ echo " "
70+ rm dotnet-sdk-riscv64.tar.gz
71+ fi
72+
3373if [ -h /usr/bin/dotnet ]; then
3474 sudo rm /usr/bin/dotnet
3575fi
3676sudo ln -s $INSTALLPATH /dotnet /usr/bin/dotnet
3777
38- rm dotnet-install.sh
39-
4078# Disabled telemetry in .NET
4179# Telemetry is collected when using any of the .NET CLI commands, such as:
4280# dotnet build
0 commit comments