aboutsummaryrefslogtreecommitdiff
path: root/scripts/.local/bin/update-dotnet
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2021-11-08 15:08:51 +0100
committerBond_009 <bond.009@outlook.com>2021-11-08 15:08:51 +0100
commitcc7d1a186e11b9b2605327d3ab37c9d33cbad528 (patch)
treeaf1493d30d1abbb71ab5719fc2b7c0c20de2adb7 /scripts/.local/bin/update-dotnet
parent52e39b248922d23c51ab8a0372b92d5d59ef7c80 (diff)
Add update-dotnet script
Diffstat (limited to 'scripts/.local/bin/update-dotnet')
-rwxr-xr-xscripts/.local/bin/update-dotnet30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/.local/bin/update-dotnet b/scripts/.local/bin/update-dotnet
new file mode 100755
index 0000000..8445183
--- /dev/null
+++ b/scripts/.local/bin/update-dotnet
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+set -ef
+
+INSTALLLOCATION="$HOME/dotnet"
+
+[ -z "$1" ] && echo "$0: missing url" && exit 1
+
+if [ -n "$2" ]; then
+ INSTALLLOCATION="$2"
+fi
+
+if [ -d "$INSTALLLOCATION" ]; then
+ echo "$INSTALLLOCATION already exists, do you want to remove it? <y/N>"
+ read -r RESPONSE
+ [ "$RESPONSE" = "y" ] && rm -r "$INSTALLLOCATION"
+fi
+
+TMPFILE=$(mktemp)
+
+mkdir -p "$INSTALLLOCATION"
+
+echo "downloading..."
+curl -o "$TMPFILE" "$1"
+echo "extracting..."
+tar zxf "$TMPFILE" -C "$INSTALLLOCATION"
+echo "cleaning up temp files..."
+rm "$TMPFILE"
+
+echo "dotnet was successfully installed in $INSTALLLOCATION"