-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathinstall.sh
executable file
·66 lines (53 loc) · 2.62 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
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
################################################################################
# This Script is used to install kubero-cli binaries. #
# #
# Supported OS: Linux, macOS ---> Windows(not supported) #
# Supported Architecture: amd64, arm64 #
# Source: https://github.com/kubero-dev/kubero-cli #
# Binary Release: https://github.com/kubero-dev/kubero-cli/releases/latest #
# License: Apache License 2.0 #
# Usage: #
# curl -fsSL get.kubero.dev | bash #
# curl -fsSL get.kubero.dev | bash -s -- v1.10.0 #
# bash <(curl -fsSL get.kubero.dev) v1.9.2 #
################################################################################
set -eo pipefail
[[ $TRACE ]] && set -x
get_os() {
case "$(uname -s)" in
Linux*) echo "linux" ;;
Darwin*) echo "darwin" ;;
*) echo "unsupported" ;;
esac
}
get_arch() {
case "$(uname -m)" in
x86_64) echo "amd64" ;;
arm*|aarch64) echo "arm64" ;;
*) echo "unsupported" ;;
esac
}
os=$(get_os)
arch=$(get_arch)
version=${1:-latest}
if [[ "$os" == "unsupported" || "$arch" == "unsupported" ]]; then
echo "Unsupported OS or architecture."
exit 1
fi
if [[ -f "/usr/local/bin/kubero" ]]; then
read -r -p "Do you want to replace it? [y/n] " replaceBinary
[[ "$replaceBinary" != "y" && "$replaceBinary" != "" ]] && echo "Aborting installation." && exit 1
fi
release_url="https://github.com/kubero-dev/kubero-cli/releases/${version}/download/kubero-cli_${os}_${arch}.tar.gz"
temp_dir=$(mktemp -d)
echo "Downloading ${release_url} ..."
curl -L -s -o "${temp_dir}/kubero-cli.tar.gz" "$release_url" || { echo "Failed to download the binary."; rm -rf "$temp_dir"; exit 1; }
echo "Unpacking the binary..."
tar -xzvf "${temp_dir}/kubero-cli.tar.gz" -C "$temp_dir" || { echo "Failed to unpack the binary."; rm -rf "$temp_dir"; exit 1; }
[[ ! -f "${temp_dir}/kubero" ]] && { echo "Failed to unpack the binary."; rm -rf "$temp_dir"; exit 1; }
echo "Installing kubero in /usr/local/bin ..."
sudo mv "${temp_dir}/kubero" "/usr/local/bin/kubero" || { echo "Failed to install kubero."; rm -rf "$temp_dir"; exit 1; }
rm -rf "$temp_dir"
echo "Kubero has been successfully installed."
echo "Run 'kubero install' to create a kubernetes cluster."