Skip to content

Commit 7afa126

Browse files
committed
Updates for Debian
1 parent 3ef094b commit 7afa126

File tree

2 files changed

+57
-40
lines changed

2 files changed

+57
-40
lines changed

src/scripts/utils.sh

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -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

src/setup.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,11 @@ writeLine "${formattedFreeSpace} of ${formattedTotalSpace} available on ${system
794794
# Install tools that we know are available via apt-get or brew
795795
if [ "$os" = "linux" ]; then
796796
checkForTool curl
797-
checkForTool pstree
797+
if [ "${os_name}" = "Debian" ]; then
798+
checkForTool psmisc
799+
else
800+
checkForTool pstree
801+
fi
798802
checkForTool xz-utils
799803
fi
800804
checkForTool wget
@@ -910,23 +914,32 @@ else
910914

911915
installKeyring=false
912916
if [ "$cuDNN_version" = "" ] || [ ! -x "$(command -v nvcc)" ]; then
913-
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
914-
sudo dpkg -i cuda-keyring_1.1-1_all.deb
917+
writeLine "Installing NVIDIA keyring" $color_info
918+
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb > /dev/null 2>&1 &
919+
spin $!
920+
sudo dpkg -i cuda-keyring_1.1-1_all.deb >/dev/null &
921+
spin $!
915922
rm cuda-keyring_1.1-1_all.deb
916923
fi
917924

918925
if [ "$cuDNN_version" = "" ]; then
926+
writeLine "Installing cuDNN" $color_info
919927
# cuDNN
920928
# https://developer.nvidia.com/cudnn-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_local
921-
sudo apt-get update
922-
sudo apt-get -y install "cudnn-cuda-$cuda_major_version"
929+
sudo apt-get update >/dev/null 2>&1 &
930+
spin $!
931+
sudo apt-get install "cudnn-cuda-$cuda_major_version" -y >/dev/null 2>&1 &
932+
spin $!
923933
fi
924934

925935
if [ ! -x "$(command -v nvcc)" ]; then
926936
# CUDA toolkit
927937
# https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_network
928-
sudo apt-get update
929-
sudo apt-get -y install cuda-toolkit-${cuda_major_version}-${cuda_minor_version}
938+
writeLine "Installing CUDA toolkit" $color_info
939+
sudo apt-get update > /dev/null 2>&1 &
940+
spin $!
941+
sudo apt-get install cuda-toolkit-${cuda_major_version}-${cuda_minor_version} -y >/dev/null 2>&1 &
942+
spin $!
930943
fi
931944

932945
# disable this

0 commit comments

Comments
 (0)