blob: 01dd20a9663cbeb31284bd02035bc295c5ee8241 [file] [log] [blame]
Pawel Wieczorek216bd6a2019-11-29 15:15:51 +01001#!/usr/bin/env bash
2
3#
4# @file test/security/k8s/tools/dublin/get_rke.sh
5# @author Pawel Wieczorek <p.wieczorek2@samsung.com>
6# @brief Utility for obtaining RKE tool
7#
8
9# Dependencies:
10# wget
11# coreutils
12#
13# Privileges:
14# Script expects to be run with administrative privileges for accessing /usr/local/bin
15#
16# Usage:
17# # ./get_rke.sh [VERSION [ARCH [SYSTEM]]]
18#
19
20# Constants
21DEFAULT_VERSION='v0.2.1'
22DEFAULT_ARCH='amd64'
23DEFAULT_SYSTEM='linux'
24
25# Variables
26VERSION="${1:-$DEFAULT_VERSION}"
27ARCH="${2:-$DEFAULT_ARCH}"
28SYSTEM="${3:-$DEFAULT_SYSTEM}"
29
30BINARY="rke_${SYSTEM}-${ARCH}"
31URL="https://github.com/rancher/rke/releases/download/${VERSION}/${BINARY}"
32
33
34# Prerequistes
35wget "$URL"
36chmod +x "$BINARY"
37
38# Installation
39mv "$BINARY" "/usr/local/bin/${BINARY%%_*}" # this also renames binary to "rke"