From 19d965efad41b443b722511db0f89dd4c87a1609 Mon Sep 17 00:00:00 2001 From: Andrew Davis <1709934+Savid@users.noreply.github.com> Date: Mon, 7 Oct 2024 11:49:35 +1000 Subject: [PATCH] handle unix grep --- install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index b6b5b6a6..0418b66a 100755 --- a/install.sh +++ b/install.sh @@ -41,7 +41,11 @@ fetch_latest_tag() { info "Fetching the latest release information from GitHub..." LATEST_RELEASE_JSON=$(curl -s "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases/latest") || error "Failed to fetch release information." - TAG=$(echo "$LATEST_RELEASE_JSON" | grep -oP '"tag_name":\s*"\K(.*)(?=")') || error "Failed to parse release tag." + if [ "$OS" = "darwin" ]; then + TAG=$(echo "$LATEST_RELEASE_JSON" | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p') || error "Failed to parse release tag." + else + TAG=$(echo "$LATEST_RELEASE_JSON" | grep -oP '"tag_name":\s*"\K(.*)(?=")') || error "Failed to parse release tag." + fi [[ -z "$TAG" ]] && error "Release tag not found." info "Latest release tag: $TAG" }