blob: 01dd20a9663cbeb31284bd02035bc295c5ee8241 [file] [log] [blame]
Pawel Wieczorekb7f08112019-07-19 19:10:07 +02001#!/usr/bin/env bash
2
Pawel Wieczorekf8a1ad02019-07-24 14:19:46 +02003#
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
Pawel Wieczorekb7f08112019-07-19 19:10:07 +020020# 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"
Pawel Wieczorek2d13ea82019-07-29 13:17:51 +020036chmod +x "$BINARY"
Pawel Wieczorekb7f08112019-07-19 19:10:07 +020037
38# Installation
Pawel Wieczorek2d13ea82019-07-29 13:17:51 +020039mv "$BINARY" "/usr/local/bin/${BINARY%%_*}" # this also renames binary to "rke"