-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·57 lines (51 loc) · 1.67 KB
/
install.sh
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
#!/bin/bash
#
# AnyOps installer
#
# Usage:
# curl -fsSL https://raw.githubusercontent.com/bhuwanupadhyay/anyops/master/install.sh | bash
# When releasing AnyOps, the releaser should update this version number
# AFTER they upload new binaries.
VERSION="1.0.0"
set -e
function copy_binary() {
if [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then
if [ ! -d "$HOME/.local/bin" ]; then
mkdir -p "$HOME/.local/bin"
fi
mv anyops "$HOME/.local/bin/anyops"
else
echo "Installing anyops to /usr/local/bin which is write protected"
echo "If you'd prefer to install Anyops without sudo permissions, add \$HOME/.local/bin to your \$PATH and rerun the installer"
sudo mv anyops /usr/local/bin/anyops
fi
}
function install_anyops() {
if [[ "$OSTYPE" == "linux"* ]]; then
case $(uname -m) in
aarch64) ARCH=arm64 ;;
armv7l) ARCH=arm ;;
*) ARCH=$(uname -m) ;;
esac
set -x
curl -fsSL https://github.com/bhuwanupadhyay/anyops/releases/download/v$VERSION/anyops-v$VERSION-linux-$ARCH.tar.gz | tar -xzv anyops
copy_binary
elif [[ "$OSTYPE" == "darwin"* ]]; then
ARCH=$(uname -m)
set -x
curl -fsSL https://github.com/bhuwanupadhyay/anyops/releases/download/v$VERSION/anyops-v$VERSION-darwin-$ARCH.tar.gz | tar -xzv anyops
copy_binary
else
set +x
echo "The AnyOps installer does not work for your platform: $OSTYPE"
echo "For other installation options, download from the following page:"
echo "https://github.com/bhuwanupadhyay/anyops/releases/"
echo "Thank you!"
exit 1
fi
set +x
}
# so that we can skip installation in CI and just test the version check
if [[ -z $NO_INSTALL ]]; then
install_anyops
fi