From f19873ee125fada6794b74cda4a4239d591342a5 Mon Sep 17 00:00:00 2001 From: David Young Date: Sat, 6 Jun 2026 06:19:51 -0600 Subject: [PATCH] update direwolf --- compile.conf | 2 +- hampackservercheck | 78 ++++++++++++++++++++++++++++++++++++++++++++++ install.sh | 1 + 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100755 hampackservercheck diff --git a/compile.conf b/compile.conf index 1dde855..e1f4a62 100644 --- a/compile.conf +++ b/compile.conf @@ -6,7 +6,7 @@ gui=true steps=cd src && make && make hamclock-web-1600x960 && mkdir -p $HOME/.local/bin && mv hamclock-web-1600x960 $HOME/.local/bin/hamclock [direwolf] -version=1.8.1 +version=1.8.2 git=https://github.com/wb2osz/direwolf.git install=$HOME/.local/bin/direwolf steps=mkdir build| cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/.local && make -j4 && sudo make install| sudo udevadm control --reload-rules| mkdir -p $HOME/.local/state/HamPack/conf.d diff --git a/hampackservercheck b/hampackservercheck new file mode 100755 index 0000000..2cfa56d --- /dev/null +++ b/hampackservercheck @@ -0,0 +1,78 @@ +#!/bin/bash + +CONF="compile.conf" + +if [ ! -f "$CONF" ]; then + echo "Error: compile.conf not found at $CONF" + exit 1 +fi + +github_owner_repo() { + local url="$1" + if [[ "$url" =~ github\.com/([^/]+)/([^/.]+) ]]; then + echo "${BASH_REMATCH[1]}/${BASH_REMATCH[2]}" + fi +} + +github_latest_tag() { + local owner_repo="$1" + local tag + tag=$(curl -sf "https://api.github.com/repos/$owner_repo/releases/latest" \ + | grep '"tag_name"' \ + | sed 's/.*"tag_name": *"\([^"]*\)".*/\1/' \ + | sed 's/^v//') + if [ -z "$tag" ]; then + tag=$(curl -sf "https://api.github.com/repos/$owner_repo/tags" \ + | grep '"name"' \ + | head -1 \ + | sed 's/.*"name": *"\([^"]*\)".*/\1/' \ + | sed 's/^v//') + fi + echo "$tag" +} + +current_section="" +current_version="" +current_url="" + +check_section() { + [ -z "$current_section" ] && return + [ -z "$current_url" ] && return + + local owner_repo + owner_repo=$(github_owner_repo "$current_url") + if [ -z "$owner_repo" ]; then + echo "$current_section: unable to determine GitHub repo from URL" + return + fi + + local latest + latest=$(github_latest_tag "$owner_repo") + if [ -z "$latest" ]; then + echo "$current_section: unable to fetch latest version" + return + fi + + if [ "$latest" = "$current_version" ]; then + echo "$current_section: up to date ($current_version)" + else + echo "$current_section: update available $current_version -> $latest" + fi +} + +while IFS= read -r line; do + if [[ "$line" =~ ^\[(.+)\]$ ]]; then + check_section + current_section="${BASH_REMATCH[1]}" + current_version="" + current_url="" + elif [[ "$line" =~ ^version=(.+)$ ]]; then + current_version="${BASH_REMATCH[1]}" + elif [[ "$line" =~ ^wget=(.+)$ ]]; then + current_url="${BASH_REMATCH[1]}" + elif [[ "$line" =~ ^git=(.+)$ ]]; then + current_url="${BASH_REMATCH[1]}" + fi +done < "$CONF" + +check_section diff --git a/install.sh b/install.sh index 4747607..cd46bbc 100755 --- a/install.sh +++ b/install.sh @@ -67,6 +67,7 @@ git clone https://gitea.young.computer/david/HamPackServer.git "$HOME/.local/sha mkdir -p "$HOME/.local/bin" cp "$HOME/.local/share/HamPackServer/hampackserverrefresh" "$HOME/.local/bin/hampackserverrefresh" cp "$HOME/.local/share/HamPackServer/hampackserverupdate" "$HOME/.local/bin/hampackserverupdate" +cp "$HOME/.local/share/HamPackServer/hampackservercheck" "$HOME/.local/bin/hampackservercheck" mkdir -p "$HOME/.local/share/hamclock" # Remove old user-level service if present