-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall
More file actions
executable file
·44 lines (38 loc) · 802 Bytes
/
install
File metadata and controls
executable file
·44 lines (38 loc) · 802 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
: "${OS:=$(uname -s)}"
: "${PREFIX:=$HOME/.local}"
: "${RELEASE_TAG:=""}"
case "$OS" in
Linux)
asset_name=stackctl-x86_64-linux.tar.gz
;;
Darwin)
asset_name=stackctl-x86_64-osx.tar.gz
;;
*)
echo "Unsupported (unknown OS: $OS)" >&2
exit 1
;;
esac
if [[ -z "$RELEASE_TAG" ]]; then
path=/releases/latest
else
path=/releases/tags/$RELEASE_TAG
fi
url=$(
curl --fail "https://api.github.com/repos/freckle/stackctl$path" |
jq --raw-output "
.assets[]
| select(.name == \"$asset_name\")
| .browser_download_url
"
)
cd /tmp
curl --fail --location "$url" | tar vxzf -
cd stackctl && make install PREFIX="$PREFIX"
echo
echo "Installed $PREFIX/bin/stackctl"
set -x +e
which stackctl
stackctl version