Pawel Wieczorek | b7f0811 | 2019-07-19 19:10:07 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
Pawel Wieczorek | f8a1ad0 | 2019-07-24 14:19:46 +0200 | [diff] [blame] | 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 | |
Pawel Wieczorek | b7f0811 | 2019-07-19 19:10:07 +0200 | [diff] [blame] | 20 | # Constants |
| 21 | DEFAULT_VERSION='v0.2.1' |
| 22 | DEFAULT_ARCH='amd64' |
| 23 | DEFAULT_SYSTEM='linux' |
| 24 | |
| 25 | # Variables |
| 26 | VERSION="${1:-$DEFAULT_VERSION}" |
| 27 | ARCH="${2:-$DEFAULT_ARCH}" |
| 28 | SYSTEM="${3:-$DEFAULT_SYSTEM}" |
| 29 | |
| 30 | BINARY="rke_${SYSTEM}-${ARCH}" |
| 31 | URL="https://github.com/rancher/rke/releases/download/${VERSION}/${BINARY}" |
| 32 | |
| 33 | |
| 34 | # Prerequistes |
| 35 | wget "$URL" |
| 36 | chmod +x "${BINARY}" |
| 37 | |
| 38 | # Installation |
Pawel Wieczorek | f8a1ad0 | 2019-07-24 14:19:46 +0200 | [diff] [blame] | 39 | mv "${BINARY}" "/usr/local/bin/${BINARY%%_*}" # this also renames binary to "rke" |