Pawel Wieczorek | f1176da | 2019-12-05 13:45:45 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # |
| 4 | # @file test/security/k8s/tools/dublin/get_helm.sh |
| 5 | # @author Pawel Wieczorek <p.wieczorek2@samsung.com> |
| 6 | # @brief Utility for obtaining helm tool |
| 7 | # |
| 8 | |
| 9 | # Dependencies: |
| 10 | # wget |
| 11 | # tar |
| 12 | # coreutils |
| 13 | # |
| 14 | # Privileges: |
| 15 | # Script expects to be run with administrative privileges for accessing /usr/local/bin |
| 16 | # |
| 17 | # Usage: |
| 18 | # # ./get_helm.sh [VERSION [ARCH [SYSTEM]]] |
| 19 | # |
| 20 | |
| 21 | # Constants |
| 22 | BINARY='helm' |
| 23 | INSTALL_DIR='/usr/local/bin/' |
| 24 | |
| 25 | DEFAULT_VERSION='v2.14.2' |
| 26 | DEFAULT_ARCH='amd64' |
| 27 | DEFAULT_SYSTEM='linux' |
| 28 | |
| 29 | # Variables |
| 30 | VERSION="${1:-$DEFAULT_VERSION}" |
| 31 | ARCH="${2:-$DEFAULT_ARCH}" |
| 32 | SYSTEM="${3:-$DEFAULT_SYSTEM}" |
| 33 | |
| 34 | URL="https://storage.googleapis.com/kubernetes-helm/${BINARY}-${VERSION}-${SYSTEM}-${ARCH}.tar.gz" |
| 35 | ARCHIVE="${URL##*/}" |
| 36 | DIR="${SYSTEM}-${ARCH}" |
| 37 | |
| 38 | |
| 39 | # Prerequistes |
| 40 | wget "$URL" |
| 41 | tar xf "$ARCHIVE" |
| 42 | |
| 43 | # Installation |
| 44 | mv "${DIR}/${BINARY}" "$INSTALL_DIR" |
| 45 | |
| 46 | # Cleanup |
| 47 | rm "$ARCHIVE" |
| 48 | rm -r "$DIR" |