From 60398be6f7d4225cfc777b18ec07b8adfe5dda27 Mon Sep 17 00:00:00 2001 From: David Bloss Date: Wed, 27 Nov 2024 12:04:14 -0600 Subject: [PATCH] install script can install known versions of cli (#358) --- install.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 68c30463..d0276069 100755 --- a/install.sh +++ b/install.sh @@ -32,7 +32,12 @@ detect_os() { # Version of the OpsLevel CLI to install get_version() { - VERSION=$(curl -sI https://github.com/OpsLevel/cli/releases/latest | grep -i "location:" | awk -F"/" '{ printf "%s", $NF }' | tr -d '\r') + if [ "$1" != "" ] && git ls-remote --tags --refs https://github.com/opslevel/opslevel-go/ | grep -q "${1}"; then + VERSION=${1} + else + VERSION=$(curl -sI https://github.com/OpsLevel/cli/releases/latest | grep -i "location:" | awk -F"/" '{ print $NF }' | tr -d '\r') + fi + if [ ! $VERSION ]; then echo "Failed while attempting to install OpsLevel's cli. Please manually install:" echo "" @@ -77,5 +82,5 @@ install_cli() { has_curl detect_arch detect_os -get_version +get_version "$1" install_cli