-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·53 lines (42 loc) · 1.09 KB
/
install.sh
File metadata and controls
executable file
·53 lines (42 loc) · 1.09 KB
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
#!/bin/sh
# Install script for dotnet-inspect.
# Usage: curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/richlander/dotnet-inspect/main/install.sh | sh
#
# Installs dotnet-inspect using dotnet-install. If dotnet-install is
# not available, it is installed first via `dotnet tool install -g`.
#
# Requires the .NET SDK.
#
# Environment variables:
# DOTNET_INSTALL_DIR Override the install directory
set -eu
main() {
ensure_dotnet_install
say "installing dotnet-inspect..."
ensure dotnet-install --package dotnet-inspect
say "done"
}
ensure_dotnet_install() {
if command -v dotnet-install > /dev/null 2>&1; then
return
fi
need_cmd dotnet
say "dotnet-install not found; installing via dotnet tool..."
ensure dotnet tool install -g dotnet-install
}
say() {
printf 'dotnet-inspect: %s\n' "$1" 1>&2
}
err() {
say "error: $1"
exit 1
}
need_cmd() {
if ! command -v "$1" > /dev/null 2>&1; then
err "need '$1' (command not found)"
fi
}
ensure() {
if ! "$@"; then err "command failed: $*"; fi
}
main "$@" || exit 1