@@ -596,26 +596,29 @@ function getDotNetVersion() {
596596
597597 comparison=-1
598598
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
605607
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
608610
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
615618 fi
616- fi
617- done <<< " $(dotnet --list-runtimes) "
618- unset IFS
619+ done <<< " $(dotnet --list-runtimes) "
620+ unset IFS
621+ fi
619622 fi
620623
621624 if [ " $highestDotNetVersion " = " 0" ]; then highestDotNetVersion=" " ; fi
@@ -803,11 +806,17 @@ function setupDotNet () {
803806 if [ " $os " = " linux" ]; then
804807
805808 # 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
807810
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
811820
812821 if [ " $requestedType " = " sdk" ]; then
813822 sudo apt-get update && sudo apt-get install -y dotnet-sdk-$requestedNetMajorMinorVersion > /dev/null
@@ -882,7 +891,7 @@ function setupDotNet () {
882891 if [ -e /usr/local/bin/dotnet ]; then
883892 rm /usr/local/bin/dotnet
884893 fi
885- ln -s ${dotnet_path} dotnet /usr/local/bin
894+ sudo ln -s ${dotnet_path} dotnet /usr/local/bin
886895
887896 if [ -f " /home/pi/.bashrc" ]; then
888897 setDotNetLocation " /home/pi/.bashrc" " ${dotnet_path} "
@@ -1110,7 +1119,7 @@ function setupPython () {
11101119
11111120 writeLine " done" $color_success
11121121
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.
11141123 # Raspberry Pi: Hold my beer
11151124 elif [ " ${edgeDevice} " = " Raspberry Pi" ] || [ " ${edgeDevice} " = " Orange Pi" ] || \
11161125 [ " ${edgeDevice} " = " Radxa ROCK" ] || [ " ${edgeDevice} " = " Jetson" ] || \
@@ -1140,7 +1149,7 @@ function setupPython () {
11401149 fi
11411150 fi
11421151
1143- pushd " ${appRootDirPath } " > /dev/null
1152+ pushd " ${rootDirPath } " > /dev/null
11441153
11451154 # Update at your leisure.
11461155 # See https://www.python.org/ftp/python/ for a complete list.
@@ -1180,7 +1189,7 @@ function setupPython () {
11801189 # https://www.aliengen.com/blog/install-python-3-7-on-a-raspberry-pi-with-raspbian-8
11811190
11821191 # Download
1183- cd $downloadDir
1192+ cd " ${downloadDirPath} "
11841193 mkdir --parents " ${os} /Lib" > /dev/null
11851194 cd " ${os} /Lib"
11861195
@@ -1233,7 +1242,7 @@ function setupPython () {
12331242 # to just what's needed, but for now we'll just throw everything at the problem
12341243 # until we find a solution to the "SSLError("Can't connect to HTTPS URL because
12351244 # 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
12371246 sudo ./configure --enable-optimizations
12381247 make
12391248 sudo make install
@@ -1276,13 +1285,8 @@ function setupPython () {
12761285 # For Linux we'll use apt-get the deadsnakes PPA to get the old version
12771286 # of python. Deadsnakes? Old python? Get it? Get it?! And who said
12781287 # 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
12861290
12871291 if [ " ${verbosity} " = " loud" ]; then
12881292
0 commit comments