From 1177ab67d6fe6020f6be860ad7d8dc2b4fc54b04 Mon Sep 17 00:00:00 2001 From: Phuong Dao Date: Sun, 25 Aug 2024 09:46:19 +0200 Subject: [PATCH] [mesheryctl] Fall back to stable release - Releases with patch, alpha, beta, and rc will not generate tar files. install script needs to check with meshery repo for the latest stable release before continue Signed-off-by: Phuong Dao --- install | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) mode change 100644 => 100755 install diff --git a/install b/install old mode 100644 new mode 100755 index 88d0f57964..8ba8820b55 --- a/install +++ b/install @@ -131,13 +131,14 @@ if [ "x${MESHERY_VERSION}" = "x" ] ; then exit; fi -# For patch releases, the meshery tar ball will not be generated, so fall back to last stable release -if [[ "$MESHERY_VERSION" == *"patch"* ]] ; then - LAST_MESHERY_VERSION=`echo $MESHERY_VERSION | awk -F '-patch' '{print $1}'` +# For patch/alpha/beta/rc releases, the meshery tar ball will not be generated, so fall back to last stable release +if [[ "$MESHERY_VERSION" =~ .+-(patch|alpha|beta|rc) ]] ; then + LAST_MESHERY_VERSION=$(git ls-remote --tags https://github.com/meshery/meshery | grep -v -E 'patch|alpha|beta|rc' | tail -1 | sed -E "s/(.+)(v.+)/\2/") printf "Patch release %s is not supported, falling back to last stable release: %s\n\n" "$MESHERY_VERSION" "$LAST_MESHERY_VERSION" MESHERY_VERSION=$LAST_MESHERY_VERSION fi + NAME="mesheryctl-${MESHERY_VERSION}" URL="https://github.com/meshery/meshery/releases/download/${MESHERY_VERSION}/mesheryctl_${MESHERY_VERSION:1}_${OSEXT}_${OSARCHITECTURE}.tar.gz"