-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·47 lines (34 loc) · 1.06 KB
/
install.sh
File metadata and controls
executable file
·47 lines (34 loc) · 1.06 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
#!/bin/sh
set -e
os=$(echo "$(uname -s)" | tr '[:upper:]' '[:lower:]')
arch=$(uname -m)
version=${1:-latest}
if [ "$arch" = "x86_64" ]; then
arch="amd64"
fi
regocli_url="https://github.com/drorIvry/rego-cli/releases/$version/download/rego-$os-$arch.tar.gz"
rego_install="${REGO_INSTALL:-$HOME/.rego}"
bin_dir="$rego_install/bin"
exe="$bin_dir/rego"
if [ ! -d "$bin_dir" ]; then
mkdir -p "$bin_dir"
fi
curl -q --fail --location --progress-bar --output "$exe.tar.gz" "$regocli_url"
cd "$bin_dir"
tar xzf "$exe.tar.gz"
chmod +x "$exe"
rm "$exe.tar.gz"
echo 'baseUrl: http://localhost:4004' > "$rego_install/.rego-cli"
echo "rego-cli was installed successfully to $exe"
if command -v rego >/dev/null; then
echo "Run 'rego --help' to get started"
else
case $SHELL in
/bin/zsh) shell_profile=".zshrc" ;;
*) shell_profile=".bash_profile" ;;
esac
echo "Manually add the directory to your \$HOME/$shell_profile (or similar)"
echo " export REGO_INSTALL=\"$rego_install\""
echo " export PATH=\"\$REGO_INSTALL/bin:\$PATH\""
echo "Run '$exe --help' to get started"
fi