aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-minimal-onap/tools/get_rke.sh
blob: 01dd20a9663cbeb31284bd02035bc295c5ee8241 (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='v0.2.1'
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"