From 0501fe3b2e0be83208631d3a75848b0477cad003 Mon Sep 17 00:00:00 2001 From: jonas Date: Tue, 26 Oct 2021 09:18:07 +0200 Subject: [PATCH] . --- update.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/update.sh b/update.sh index 73d492c..957c549 100755 --- a/update.sh +++ b/update.sh @@ -142,6 +142,7 @@ function install_tools(){ echo "- kubectl" echo "- helm" echo "- stern" + echo "- virtctl" if asktobreak; then return fi @@ -200,6 +201,21 @@ function install_tools(){ fi echo "" + echo "---- virtctl ----" + if [[ -f stern ]]; then + VIRTCTL_CURRENT="$(./virtctl version --client 2> /dev/null| sed -n 's/.*GitVersion:"\(v[0-9]*\.[0-9]*\.[0-9]*\)".*/\1/p')" + else + VIRTCTL_CURRENT="N/A" + fi + VIRTCTL_STABLE="$(curl -Ls https://github.com/kubevirt/kubevirt/releases | egrep 'href="/kubevirt/kubevirt/releases/tag/v[0-9]+.[0-9]+.[0-9]+*\"' | head -n 1 | sed -n 's/.*tag\/\(v.*\)" data.*/\1/p')" + echo "Installed version: $VIRTCTL_CURRENT" + echo "Latest stable version: $VIRTCTL_STABLE" + if [[ "$VIRTCTL_CURRENT" != "$VIRTCTL_STABLE" ]]; then + echo "updating to $VIRTCTL_STABLE" + curl -Lo virtctl https://github.com/kubevirt/kubevirt/releases/download/$VIRTCTL_STABLE/virtctl-$VIRTCTL_STABLE-linux-amd64 + chmod +x ./virtctl + fi + echo "" set -e }