Rename gotk binary to flux
Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# GOTK CLI Installation
|
||||
# flux CLI Installation
|
||||
|
||||
Binaries for macOS and Linux AMD64 are available for download on the
|
||||
[release page](https://github.com/fluxcd/toolkit/releases).
|
||||
@@ -6,19 +6,19 @@ Binaries for macOS and Linux AMD64 are available for download on the
|
||||
To install the latest release run:
|
||||
|
||||
```bash
|
||||
curl -s https://raw.githubusercontent.com/fluxcd/toolkit/master/install/gotk.sh | sudo bash
|
||||
curl -s https://raw.githubusercontent.com/fluxcd/toolkit/master/install/flux.sh | sudo bash
|
||||
```
|
||||
|
||||
The install script does the following:
|
||||
* attempts to detect your OS
|
||||
* downloads and unpacks the release tar file in a temporary directory
|
||||
* copies the gotk binary to `/usr/local/bin`
|
||||
* copies the flux binary to `/usr/local/bin`
|
||||
* removes the temporary directory
|
||||
|
||||
If you want to use gotk as a kubectl plugin, rename the binary to `kubectl-gotk`:
|
||||
If you want to use flux as a kubectl plugin, rename the binary to `kubectl-flux`:
|
||||
|
||||
```sh
|
||||
mv /usr/local/bin/gotk /usr/local/bin/kubectl-gotk
|
||||
mv /usr/local/bin/flux /usr/local/bin/kubectl-flux
|
||||
```
|
||||
|
||||
## Build from source
|
||||
@@ -30,7 +30,7 @@ git clone https://github.com/fluxcd/toolkit
|
||||
cd toolkit
|
||||
```
|
||||
|
||||
Build the `gotk` binary (requires go >= 1.14):
|
||||
Build the `flux` binary (requires go >= 1.14):
|
||||
|
||||
```bash
|
||||
make build
|
||||
@@ -39,5 +39,5 @@ make build
|
||||
Run the binary:
|
||||
|
||||
```bash
|
||||
./bin/gotk -h
|
||||
./bin/flux -h
|
||||
```
|
||||
|
||||
@@ -68,10 +68,10 @@ verify_downloader() {
|
||||
|
||||
# Create tempory directory and cleanup when done
|
||||
setup_tmp() {
|
||||
TMP_DIR=$(mktemp -d -t gotk-install.XXXXXXXXXX)
|
||||
TMP_METADATA="${TMP_DIR}/gotk.json"
|
||||
TMP_HASH="${TMP_DIR}/gotk.hash"
|
||||
TMP_BIN="${TMP_DIR}/gotk.tar.gz"
|
||||
TMP_DIR=$(mktemp -d -t flux-install.XXXXXXXXXX)
|
||||
TMP_METADATA="${TMP_DIR}/flux.json"
|
||||
TMP_HASH="${TMP_DIR}/flux.hash"
|
||||
TMP_BIN="${TMP_DIR}/flux.tar.gz"
|
||||
cleanup() {
|
||||
code=$?
|
||||
set +e
|
||||
@@ -89,9 +89,9 @@ get_release_version() {
|
||||
info "Downloading metadata ${METADATA_URL}"
|
||||
download "${TMP_METADATA}" "${METADATA_URL}"
|
||||
|
||||
VERSION_GOTK=$(grep '"tag_name":' "${TMP_METADATA}" | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 2-)
|
||||
if [[ -n "${VERSION_GOTK}" ]]; then
|
||||
info "Using ${VERSION_GOTK} as release"
|
||||
VERSION_FLUX=$(grep '"tag_name":' "${TMP_METADATA}" | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 2-)
|
||||
if [[ -n "${VERSION_FLUX}" ]]; then
|
||||
info "Using ${VERSION_FLUX} as release"
|
||||
else
|
||||
fatal "Unable to determine release version"
|
||||
fi
|
||||
@@ -119,16 +119,16 @@ download() {
|
||||
|
||||
# Download hash from Github URL
|
||||
download_hash() {
|
||||
HASH_URL="https://github.com/${GITHUB_REPO}/releases/download/v${VERSION_GOTK}/toolkit_${VERSION_GOTK}_checksums.txt"
|
||||
HASH_URL="https://github.com/${GITHUB_REPO}/releases/download/v${VERSION_FLUX}/toolkit_${VERSION_FLUX}_checksums.txt"
|
||||
info "Downloading hash ${HASH_URL}"
|
||||
download "${TMP_HASH}" "${HASH_URL}"
|
||||
HASH_EXPECTED=$(grep " gotk_${VERSION_GOTK}_${OS}_${ARCH}.tar.gz$" "${TMP_HASH}")
|
||||
HASH_EXPECTED=$(grep " flux_${VERSION_FLUX}_${OS}_${ARCH}.tar.gz$" "${TMP_HASH}")
|
||||
HASH_EXPECTED=${HASH_EXPECTED%%[[:blank:]]*}
|
||||
}
|
||||
|
||||
# Download binary from Github URL
|
||||
download_binary() {
|
||||
BIN_URL="https://github.com/${GITHUB_REPO}/releases/download/v${VERSION_GOTK}/gotk_${VERSION_GOTK}_${OS}_${ARCH}.tar.gz"
|
||||
BIN_URL="https://github.com/${GITHUB_REPO}/releases/download/v${VERSION_FLUX}/flux_${VERSION_FLUX}_${OS}_${ARCH}.tar.gz"
|
||||
info "Downloading binary ${BIN_URL}"
|
||||
download "${TMP_BIN}" "${BIN_URL}"
|
||||
}
|
||||
@@ -161,10 +161,10 @@ verify_binary() {
|
||||
# Setup permissions and move binary
|
||||
setup_binary() {
|
||||
chmod 755 "${TMP_BIN}"
|
||||
info "Installing gotk to ${BIN_DIR}/gotk"
|
||||
info "Installing flux to ${BIN_DIR}/flux"
|
||||
tar -xzf "${TMP_BIN}" -C "${TMP_DIR}"
|
||||
|
||||
local CMD_MOVE="mv -f \"${TMP_DIR}/gotk\" \"${BIN_DIR}\""
|
||||
local CMD_MOVE="mv -f \"${TMP_DIR}/flux\" \"${BIN_DIR}\""
|
||||
if [[ -w "${BIN_DIR}" ]]; then
|
||||
eval "${CMD_MOVE}"
|
||||
else
|
||||
Reference in New Issue
Block a user