Pawel Wieczorek | a65cd1c | 2019-06-27 17:49:21 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
Pawel Wieczorek | 60fef55 | 2019-06-27 18:11:16 +0200 | [diff] [blame] | 3 | # Constants |
| 4 | DEFAULT_VERSION='v0.6.12' |
| 5 | DEFAULT_ARCH='amd64' |
| 6 | DEFAULT_SYSTEM='linux' |
| 7 | |
| 8 | # Variables |
| 9 | VERSION="${1:-$DEFAULT_VERSION}" |
| 10 | ARCH="${2:-$DEFAULT_ARCH}" |
| 11 | SYSTEM="${3:-$DEFAULT_SYSTEM}" |
| 12 | |
| 13 | ARCHIVE="rancher-${SYSTEM}-${ARCHITECTURE}-${VERSION}.tar.gz" |
| 14 | DIRECTORY="rancher-${VERSION}" |
| 15 | URL="https://releases.rancher.com/cli/${VERSION}/${ARCHIVE}" |
| 16 | |
| 17 | |
Pawel Wieczorek | a65cd1c | 2019-06-27 17:49:21 +0200 | [diff] [blame] | 18 | # Prerequistes |
Pawel Wieczorek | 60fef55 | 2019-06-27 18:11:16 +0200 | [diff] [blame] | 19 | wget "$URL" |
| 20 | tar xf "$ARCHIVE" |
Pawel Wieczorek | a65cd1c | 2019-06-27 17:49:21 +0200 | [diff] [blame] | 21 | |
| 22 | # Installation |
| 23 | echo '# Privilege elevation needed to move Rancher CLI binary to /usr/local/bin' |
Pawel Wieczorek | 60fef55 | 2019-06-27 18:11:16 +0200 | [diff] [blame] | 24 | sudo mv "${DIRECTORY}/rancher" /usr/local/bin/ |
Pawel Wieczorek | a65cd1c | 2019-06-27 17:49:21 +0200 | [diff] [blame] | 25 | |
| 26 | # Cleanup |
Pawel Wieczorek | 60fef55 | 2019-06-27 18:11:16 +0200 | [diff] [blame] | 27 | rmdir "$DIRECTORY" |
| 28 | rm "$ARCHIVE" |