diff options
| author | Bond_009 <bond.009@outlook.com> | 2021-11-08 15:08:51 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2021-11-08 15:08:51 +0100 |
| commit | cc7d1a186e11b9b2605327d3ab37c9d33cbad528 (patch) | |
| tree | af1493d30d1abbb71ab5719fc2b7c0c20de2adb7 /scripts/.local/bin/update-dotnet | |
| parent | 52e39b248922d23c51ab8a0372b92d5d59ef7c80 (diff) | |
Add update-dotnet script
Diffstat (limited to 'scripts/.local/bin/update-dotnet')
| -rwxr-xr-x | scripts/.local/bin/update-dotnet | 30 |
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" |
