@@ -596,26 +596,29 @@ function getDotNetVersion() {
596
596
597
597
comparison=-1
598
598
599
- IFS=$' \n ' # set the Internal Field Separator as end of line
600
- while read -r line
601
- do
602
- if [[ $line == * ' Microsoft.NETCore.App ' * ]]; then
603
- dotnet_version=$( echo " ${line} " | cut -d ' ' -f 2)
604
- # echo "GET: Found .NET runtime $dotnet_version" >&3
599
+ if command -v dotnet > /dev/null 2> /dev/null; then
600
+
601
+ IFS=$' \n ' # set the Internal Field Separator as end of line
602
+ while read -r line
603
+ do
604
+ if [[ $line == * ' Microsoft.NETCore.App ' * ]]; then
605
+ dotnet_version=$( echo " ${line} " | cut -d ' ' -f 2)
606
+ # echo "GET: Found .NET runtime $dotnet_version" >&3
605
607
606
- current_comparison=$( versionCompare $dotnet_version $highestDotNetVersion )
607
- # echo "GET: current compare ${comparison}, new compare ${current_comparison}" >&3
608
+ current_comparison=$( versionCompare $dotnet_version $highestDotNetVersion )
609
+ # echo "GET: current compare ${comparison}, new compare ${current_comparison}" >&3
608
610
609
- if (( $current_comparison >= $comparison )) ; then
610
- highestDotNetVersion=" $dotnet_version "
611
- comparison=$current_comparison
612
- # echo "GET: Found new highest .NET runtime $highestDotNetVersion" >&3
613
- # else
614
- # echo "GET: Found $dotnet_version runtime, which is not higher than $highestDotNetVersion" >&3
611
+ if (( $current_comparison >= $comparison )) ; then
612
+ highestDotNetVersion=" $dotnet_version "
613
+ comparison=$current_comparison
614
+ # echo "GET: Found new highest .NET runtime $highestDotNetVersion" >&3
615
+ # else
616
+ # echo "GET: Found $dotnet_version runtime, which is not higher than $highestDotNetVersion" >&3
617
+ fi
615
618
fi
616
- fi
617
- done <<< " $(dotnet --list-runtimes) "
618
- unset IFS
619
+ done <<< " $(dotnet --list-runtimes) "
620
+ unset IFS
621
+ fi
619
622
fi
620
623
621
624
if [ " $highestDotNetVersion " = " 0" ]; then highestDotNetVersion=" " ; fi
@@ -803,11 +806,17 @@ function setupDotNet () {
803
806
if [ " $os " = " linux" ]; then
804
807
805
808
# Potentially not reliable. Only blessed by MS for Debian >= 12
806
- if [ " $os_name " = " debian" ] && [ ! " $os_vers " < " 12" ]; then
809
+ if [ " $os_name " = " debian" ] && [ ! " $os_vers " -lt " 12" ]; then
807
810
808
- wget https://packages.microsoft.com/config/debian/${os_vers} /packages-microsoft-prod.deb -O packages-microsoft-prod.deb > /dev/null
809
- sudo dpkg -i packages-microsoft-prod.deb > /dev/null
810
- rm packages-microsoft-prod.deb > /dev/null
811
+ if [ $verbosity = " quiet" ]; then
812
+ wget https://packages.microsoft.com/config/debian/${os_vers} /packages-microsoft-prod.deb -O packages-microsoft-prod.deb > /dev/null
813
+ sudo dpkg -i packages-microsoft-prod.deb > /dev/null
814
+ rm packages-microsoft-prod.deb > /dev/null
815
+ else
816
+ wget https://packages.microsoft.com/config/debian/${os_vers} /packages-microsoft-prod.deb -O packages-microsoft-prod.deb
817
+ sudo dpkg -i packages-microsoft-prod.deb
818
+ rm packages-microsoft-prod.deb
819
+ fi
811
820
812
821
if [ " $requestedType " = " sdk" ]; then
813
822
sudo apt-get update && sudo apt-get install -y dotnet-sdk-$requestedNetMajorMinorVersion > /dev/null
@@ -882,7 +891,7 @@ function setupDotNet () {
882
891
if [ -e /usr/local/bin/dotnet ]; then
883
892
rm /usr/local/bin/dotnet
884
893
fi
885
- ln -s ${dotnet_path} dotnet /usr/local/bin
894
+ sudo ln -s ${dotnet_path} dotnet /usr/local/bin
886
895
887
896
if [ -f " /home/pi/.bashrc" ]; then
888
897
setDotNetLocation " /home/pi/.bashrc" " ${dotnet_path} "
@@ -1110,7 +1119,7 @@ function setupPython () {
1110
1119
1111
1120
writeLine " done" $color_success
1112
1121
1113
- # macOS: With my M1 chip and Rosetta I make installing Python a real PITA.
1122
+ # macOS: With my M1 chip and Rosetta, I make installing Python a real PITA.
1114
1123
# Raspberry Pi: Hold my beer
1115
1124
elif [ " ${edgeDevice} " = " Raspberry Pi" ] || [ " ${edgeDevice} " = " Orange Pi" ] || \
1116
1125
[ " ${edgeDevice} " = " Radxa ROCK" ] || [ " ${edgeDevice} " = " Jetson" ] || \
@@ -1140,7 +1149,7 @@ function setupPython () {
1140
1149
fi
1141
1150
fi
1142
1151
1143
- pushd " ${appRootDirPath } " > /dev/null
1152
+ pushd " ${rootDirPath } " > /dev/null
1144
1153
1145
1154
# Update at your leisure.
1146
1155
# See https://www.python.org/ftp/python/ for a complete list.
@@ -1180,7 +1189,7 @@ function setupPython () {
1180
1189
# https://www.aliengen.com/blog/install-python-3-7-on-a-raspberry-pi-with-raspbian-8
1181
1190
1182
1191
# Download
1183
- cd $downloadDir
1192
+ cd " ${downloadDirPath} "
1184
1193
mkdir --parents " ${os} /Lib" > /dev/null
1185
1194
cd " ${os} /Lib"
1186
1195
@@ -1233,7 +1242,7 @@ function setupPython () {
1233
1242
# to just what's needed, but for now we'll just throw everything at the problem
1234
1243
# until we find a solution to the "SSLError("Can't connect to HTTPS URL because
1235
1244
# the SSL module is not available.")' issue
1236
- sudo apt-get install libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev libtk8.6 libgdm-dev libdb4o-cil-dev libpcap-dev
1245
+ sudo apt-get install libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev libtk8.6 libgdm-dev libdb4o-cil-dev libpcap-dev -y
1237
1246
sudo ./configure --enable-optimizations
1238
1247
make
1239
1248
sudo make install
@@ -1276,13 +1285,8 @@ function setupPython () {
1276
1285
# For Linux we'll use apt-get the deadsnakes PPA to get the old version
1277
1286
# of python. Deadsnakes? Old python? Get it? Get it?! And who said
1278
1287
# developers have no sense of humour.
1279
- else
1280
-
1281
- # https://askubuntu.com/a/1481830
1282
- # if [ "$os_name" = "debian" ]; then
1283
- # This allows adding the deadsnakes PPA, but this ppa doesn't support debian
1284
- # sudo apt-get install python3-launchpadlib -y
1285
- # fi
1288
+ # NOTE: ppa is an Ubuntu thing only. https://askubuntu.com/a/1481830
1289
+ else # if [ "$os_name" = "ubuntu" ]; then
1286
1290
1287
1291
if [ " ${verbosity} " = " loud" ]; then
1288
1292
0 commit comments