-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh.txt
47 lines (37 loc) · 1.55 KB
/
install.sh.txt
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
(@ load("@ytt:data", "data") @)
(@ load("helpers.star", "addProtocol") @)
#!/bin/bash
## **This is an autogenerated file, do not change it manually**
if test -z "$BASH_VERSION"; then
echo "Please run this script using bash, not sh or any other shell." >&2
exit 1
fi
install() {
set -euo pipefail
dst_dir="${K14SIO_INSTALL_BIN_DIR:-/usr/local/bin}"
if [ -x "$(command -v wget)" ]; then
dl_bin="wget -nv -O-"
else
dl_bin="curl -s -L"
fi
shasum -v 1>/dev/null 2>&1 || (echo "Missing shasum binary" && exit 1)
if [[ `uname` == Darwin ]]; then
binary_type=darwin-amd64
(@ for val in data.values.products: @)(@ for asset in val.assets: @)(@ if asset.os == "darwin" and asset.arch=="amd64": @)
(@=val.product @)_checksum=(@=asset.shasum @)(@ end @)(@ end @)(@ end @)
else
binary_type=linux-amd64
(@ for val in data.values.products: @)(@ for asset in val.assets: @)(@ if asset.os == "linux" and asset.arch=="amd64": @)
(@=val.product @)_checksum=(@=asset.shasum @)(@ end @)(@ end @)(@ end @)
fi
echo "Installing ${binary_type} binaries..."
(@ for val in data.values.products: @)
echo "Installing (@= val.product @)..."
$dl_bin (@= addProtocol(val.github.url) @)/releases/download/(@= val.version @)/(@= val.product @)-${binary_type} > /tmp/(@= val.product @)
echo "${(@= val.product @)_checksum} /tmp/(@= val.product @)" | shasum -c -
mv /tmp/(@= val.product @) ${dst_dir}/(@= val.product @)
chmod +x ${dst_dir}/(@= val.product @)
echo "Installed ${dst_dir}/(@= val.product @) (@= val.version @)"
(@ end @)
}
install