From 1c26dfdedc2b813ded281d8db6bd684e075c2cfb Mon Sep 17 00:00:00 2001 From: MickLesk Date: Fri, 15 May 2026 21:28:47 +0200 Subject: [PATCH] Ollama: fix version extraction from GitHub API compact JSON response --- ct/ollama.sh | 6 +++++- install/ollama-install.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ct/ollama.sh b/ct/ollama.sh index 0864040b3..cd7374ed9 100644 --- a/ct/ollama.sh +++ b/ct/ollama.sh @@ -27,7 +27,11 @@ function update_script() { msg_error "No Ollama Installation Found!" exit fi - RELEASE=$(curl -fsSL https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk -F '"' '{print $4}') + RELEASE=$(curl -fsSL "https://api.github.com/repos/ollama/ollama/releases/latest" | sed -n 's/.*"tag_name" *: *"\([^"]*\)".*/\1/p' | head -1) + if [[ -z "${RELEASE}" || ! "${RELEASE}" =~ ^v[0-9] ]]; then + msg_error "Failed to determine latest Ollama version" + exit 1 + fi if [[ ! -f /opt/Ollama_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/Ollama_version.txt)" ]]; then if [[ ! -f /opt/Ollama_version.txt ]]; then touch /opt/Ollama_version.txt diff --git a/install/ollama-install.sh b/install/ollama-install.sh index 161d354fa..3c2a5691a 100644 --- a/install/ollama-install.sh +++ b/install/ollama-install.sh @@ -62,7 +62,11 @@ $STD apt install -y --no-install-recommends intel-basekit-2024.1 msg_ok "Installed IntelĀ® oneAPI Base Toolkit" msg_info "Installing Ollama (Patience)" -RELEASE=$(curl -fsSL https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk -F '"' '{print $4}') +RELEASE=$(curl -fsSL "https://api.github.com/repos/ollama/ollama/releases/latest" | sed -n 's/.*"tag_name" *: *"\([^"]*\)".*/\1/p' | head -1) +if [[ -z "${RELEASE}" || ! "${RELEASE}" =~ ^v[0-9] ]]; then + msg_error "Failed to determine latest Ollama version" + exit 1 +fi OLLAMA_INSTALL_DIR="/usr/local/lib/ollama" BINDIR="/usr/local/bin" mkdir -p $OLLAMA_INSTALL_DIR