From 7658b34e56c8621ba9654c9f073c92f703dc6bfb Mon Sep 17 00:00:00 2001 From: Andrei Jiroh Eugenio Halili Date: Mon, 31 May 2021 20:54:35 +0800 Subject: [PATCH] feat(bin): Add scripts to update cloudflared and Minikube Signed-off-by: Andrei Jiroh Eugenio Halili --- bin/cloudflared-updater | 34 ++++++++++++++++++++++++++++++++++ bin/minikube-updater | 19 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100755 bin/cloudflared-updater create mode 100755 bin/minikube-updater diff --git a/bin/cloudflared-updater b/bin/cloudflared-updater new file mode 100755 index 0000000..601e6d3 --- /dev/null +++ b/bin/cloudflared-updater @@ -0,0 +1,34 @@ +#!/bin/bash + +# Updater script for Cloudflared +# Basically it's an script for installing Cloudflared +# during image build btw + +# pull the builder's arch first +ARCH_TO_USE="$IMAGE_ARCH" + +if [[ $ARCH_TO_USE == "" ]]; then + ARCH_TO_USE="$(uname -p)" +fi + +if [[ -f /usr/local/bin/cloudflared ]]; then + echo "[cloudlfared-updater] Removing old version..." + sudo rm -fv /usr/local/bin/cloudflared +fi + +CLOUDFLARED_VERSION=$(curl --silent "https://api.github.com/repos/cloudflare/cloudflared/releases/latest" | jq -r .tag_name) + +echo "[cloudflared-updater] Installing latest version of Argo Tunnel agent.." +if [[ $ARCH_TO_USE == "aarch64" ]]; then + sudo wget https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}/cloudflared-linux-arm64 -O /usr/local/bin/cloudflared +else + sudo wget https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}/cloudflared-linux-amd64 -O /usr/local/bin/cloudflared +fi +sudo chmod +x /usr/local/bin/cloudflared + +if [[ $? == "0" ]]; then + echo "[cloudflared-installer] Successfully updated!" +else + echo "[cloudlfared-installer] Installer failed, exiting..." + exit $? +fi diff --git a/bin/minikube-updater b/bin/minikube-updater new file mode 100755 index 0000000..6862f94 --- /dev/null +++ b/bin/minikube-updater @@ -0,0 +1,19 @@ +#!/bin/bash + +install() { + if [ ! -f "/usr/local/bin/minikube"]; then + rm -v /usr/local/bin/minikube + fi + + sudo wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -O /usr/local/bin/minikube + sudo chmod +x /usr/local/bin/minikube +} + +# Install virtualbox and the extension packs +sudo apt install virtualbox virtualbox-ext-pack + +# then download the latest Minukube version +install + +# finally, check if it's success. +minikube version \ No newline at end of file