From a5a143111c677e267f089bde423b4504f03d9b2c Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Date: Tue, 11 Feb 2025 14:42:09 +0100 Subject: [PATCH] Update Checkmk version grepping (#2264) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rögl-Brunner Michel --- ct/checkmk.sh | 2 +- install/checkmk-install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ct/checkmk.sh b/ct/checkmk.sh index f1f930b8..9088ee9b 100644 --- a/ct/checkmk.sh +++ b/ct/checkmk.sh @@ -29,7 +29,7 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - RELEASE=$(curl -fsSL https://api.github.com/repos/checkmk/checkmk/tags | grep "name" | awk '{print substr($2, 3, length($2)-4) }') + RELEASE=$(curl -fsSL https://api.github.com/repos/checkmk/checkmk/tags | grep "name" | awk '{print substr($2, 3, length($2)-4) }' | tr ' ' '\n' | grep -v '\-rc' | sort -V | tail -n 1) if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then msg_info "Updating ${APP} to v${RELEASE}" omd stop monitoring &>/dev/null diff --git a/install/checkmk-install.sh b/install/checkmk-install.sh index 12328af7..e718894e 100644 --- a/install/checkmk-install.sh +++ b/install/checkmk-install.sh @@ -22,7 +22,7 @@ $STD apt-get install -y \ msg_ok "Installed Dependencies" msg_info "Install Checkmk" -RELEASE=$(curl -fsSL https://api.github.com/repos/checkmk/checkmk/tags | grep "name" | awk '{print substr($2, 3, length($2)-4) }' | head -n 1) +RELEASE=$(curl -fsSL https://api.github.com/repos/checkmk/checkmk/tags | grep "name" | awk '{print substr($2, 3, length($2)-4) }' | tr ' ' '\n' | grep -v '\-rc' | sort -V | tail -n 1) wget -q https://download.checkmk.com/checkmk/${RELEASE}/check-mk-raw-${RELEASE}_0.bookworm_amd64.deb -O /opt/checkmk.deb $STD apt-get install -y /opt/checkmk.deb echo "${RELEASE}" >"/opt/checkmk_version.txt"