aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-minimal-onap/tools/get_rke.sh
blob: 1aed2dc02f6e26736d8f663f52d54da223941adb (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
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash

#
# @file        test/security/k8s/tools/dublin/get_rke.sh
# @author      Pawel Wieczorek <p.wieczorek2@samsung.com>
# @brief       Utility for obtaining RKE tool
#

# Dependencies:
#     wget
#     coreutils
#
# Privileges:
# Script expects to be run with administrative privileges for accessing /usr/local/bin
#
# Usage:
# # ./get_rke.sh [VERSION [ARCH [SYSTEM]]]
#

# Constants
DEFAULT_VERSION='v1.0.6'
DEFAULT_ARCH='amd64'
DEFAULT_SYSTEM='linux'

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

BINARY="rke_${SYSTEM}-${ARCH}"
URL="https://github.com/rancher/rke/releases/download/${VERSION}/${BINARY}"


# Prerequistes
wget "$URL"
chmod +x "$BINARY"

# Installation
mv "$BINARY" "/usr/local/bin/${BINARY%%_*}" # this also renames binary to "rke"