Pawel Wieczorek | 216bd6a | 2019-11-29 15:15:51 +0100 | [diff] [blame] | 1 | #!/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 |
| 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 |
| 39 | mv "$BINARY" "/usr/local/bin/${BINARY%%_*}" # this also renames binary to "rke" |