-
Notifications
You must be signed in to change notification settings - Fork 0
/
dotnet
74 lines (62 loc) · 2.06 KB
/
dotnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
# Change to required sdk version
#SDK_FILE="dotnet-sdk-5.0.103-linux-x64.tar.gz"
SDK_FILE="dotnet-sdk-6.0.101-linux-x64.tar.gz"
# -------- DO NOT EDIT BELOW----------------
#URL="https://download.visualstudio.microsoft.com/download/pr/a2052604-de46-4cd4-8256-9bc222537d32/a798771950904eaf91c0c37c58f516e1"
URL="https://download.visualstudio.microsoft.com/download/pr/ede8a287-3d61-4988-a356-32ff9129079e/bdb47b6b510ed0c4f0b132f7f4ad9d5a"
SDK_DIR="sdk"
exec 3>&1
if [ -t 1 ] && command -v tput > /dev/null; then
# see if it supports colors
ncolors=$(tput colors)
if [ -n "$ncolors" ] && [ $ncolors -ge 8 ]; then
bold="$(tput bold || echo)"
normal="$(tput sgr0 || echo)"
black="$(tput setaf 0 || echo)"
red="$(tput setaf 1 || echo)"
green="$(tput setaf 2 || echo)"
yellow="$(tput setaf 3 || echo)"
blue="$(tput setaf 4 || echo)"
magenta="$(tput setaf 5 || echo)"
cyan="$(tput setaf 6 || echo)"
white="$(tput setaf 7 || echo)"
fi
fi
say_warning() {
printf "%b\n" "${yellow:-}dotnet_install: Warning: $1${normal:-}"
}
say_err() {
printf "%b\n" "${red:-}dotnet_install: Error: $1${normal:-}" >&2
}
say() {
# using stream 3 (defined in the beginning) to not interfere with stdout of functions
# which may be used as return value
printf "%b\n" "${cyan:-}dotnet-install:${normal:-} $1" >&3
}
say_verbose() {
if [ "$verbose" = true ]; then
say "$1"
fi
}
remove_sdk_dir() {
if [ -d $SDK_DIR ]; then
say "Deleting old SDK installation"
rm -rf $SDK_DIR
fi
}
install_sdk() {
# check if sdk not installed
if [[ ! -d $SDK_DIR || ! -f $SDK_DIR/dotnet ]]; then
remove_sdk_dir
say "Downloading $SDK_FILE"
wget -q --show-progress "$URL/$SDK_FILE"
mkdir $SDK_DIR
say "Extracting $SDK_FILE"
tar xzf $SDK_FILE -C $SDK_DIR
rm $SDK_FILE
say "Finished installation of $SDK_FILE"
fi
}
install_sdk
$HOME/$REPL_SLUG/sdk/dotnet "$@"