blob: a5295fb175c7044b3af7afd85fca13e68bef8f8d [file] [log] [blame]
Pawel Wieczoreka65cd1c2019-06-27 17:49:21 +02001#!/usr/bin/env bash
2
Pawel Wieczorek60fef552019-06-27 18:11:16 +02003# Constants
4DEFAULT_VERSION='v0.6.12'
5DEFAULT_ARCH='amd64'
6DEFAULT_SYSTEM='linux'
7
8# Variables
9VERSION="${1:-$DEFAULT_VERSION}"
10ARCH="${2:-$DEFAULT_ARCH}"
11SYSTEM="${3:-$DEFAULT_SYSTEM}"
12
13ARCHIVE="rancher-${SYSTEM}-${ARCHITECTURE}-${VERSION}.tar.gz"
14DIRECTORY="rancher-${VERSION}"
15URL="https://releases.rancher.com/cli/${VERSION}/${ARCHIVE}"
16
17
Pawel Wieczoreka65cd1c2019-06-27 17:49:21 +020018# Prerequistes
Pawel Wieczorek60fef552019-06-27 18:11:16 +020019wget "$URL"
20tar xf "$ARCHIVE"
Pawel Wieczoreka65cd1c2019-06-27 17:49:21 +020021
22# Installation
23echo '# Privilege elevation needed to move Rancher CLI binary to /usr/local/bin'
Pawel Wieczorek60fef552019-06-27 18:11:16 +020024sudo mv "${DIRECTORY}/rancher" /usr/local/bin/
Pawel Wieczoreka65cd1c2019-06-27 17:49:21 +020025
26# Cleanup
Pawel Wieczorek60fef552019-06-27 18:11:16 +020027rmdir "$DIRECTORY"
28rm "$ARCHIVE"