feat(bin): Add scripts to update cloudflared and Minikube

Signed-off-by: Andrei Jiroh Eugenio Halili <andreijiroh@madebythepins.tk>
This commit is contained in:
Andrei Jiroh Eugenio Halili 2021-05-31 20:54:35 +08:00
parent 6604004ae6
commit 7658b34e56
Signed by: ajhalili2006
GPG Key ID: A30EBE40AD856D88
2 changed files with 53 additions and 0 deletions

34
bin/cloudflared-updater Executable file
View File

@ -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

19
bin/minikube-updater Executable file
View File

@ -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