aboutsummaryrefslogtreecommitdiffstats
path: root/test/security/k8s/tools/get_ranchercli.sh
blob: a5295fb175c7044b3af7afd85fca13e68bef8f8d (plain)
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
#!/usr/bin/env bash

# Constants
DEFAULT_VERSION='v0.6.12'
DEFAULT_ARCH='amd64'
DEFAULT_SYSTEM='linux'

# Variables
VERSION="${1:-$DEFAULT_VERSION}"
ARCH="${2:-$DEFAULT_ARCH}"
SYSTEM="${3:-$DEFAULT_SYSTEM}"

ARCHIVE="rancher-${SYSTEM}-${ARCHITECTURE}-${VERSION}.tar.gz"
DIRECTORY="rancher-${VERSION}"
URL="https://releases.rancher.com/cli/${VERSION}/${ARCHIVE}"


# Prerequistes
wget "$URL"
tar xf "$ARCHIVE"

# Installation
echo '# Privilege elevation needed to move Rancher CLI binary to /usr/local/bin'
sudo mv "${DIRECTORY}/rancher" /usr/local/bin/

# Cleanup
rmdir "$DIRECTORY"
rm "$ARCHIVE"