Skip to content

Commit

Permalink
install script can install known versions of cli (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbloss authored Nov 27, 2024
1 parent 802f753 commit 60398be
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down Expand Up @@ -77,5 +82,5 @@ install_cli() {
has_curl
detect_arch
detect_os
get_version
get_version "$1"
install_cli

0 comments on commit 60398be

Please sign in to comment.