From cc7d1a186e11b9b2605327d3ab37c9d33cbad528 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Mon, 8 Nov 2021 15:08:51 +0100 Subject: Add update-dotnet script --- scripts/.local/bin/update-dotnet | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 scripts/.local/bin/update-dotnet (limited to 'scripts') 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? " + 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" -- cgit v1.2.3