From fe2a38857baeb406915a6b39062a9e18d7432ab3 Mon Sep 17 00:00:00 2001 From: PTah Date: Thu, 28 May 2026 09:34:19 +1000 Subject: [PATCH] =?UTF-8?q?chore:=20release=201.2.4-SAC=20=E2=80=94=20SAC?= =?UTF-8?q?=20ingest=20HTTP=20201/409/202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bump SSH_MONITOR_VERSION; sac-client release tag; updater logs sac-client ver. Co-authored-by: Cursor --- sac-client.sh | 1 + ssh-monitor | 2 +- update_ssh_monitor.sh | 20 +++++++++++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/sac-client.sh b/sac-client.sh index 8c93f41..475f63d 100644 --- a/sac-client.sh +++ b/sac-client.sh @@ -1,4 +1,5 @@ # SAC client for ssh-monitor (source from ssh-monitor) +# SAC client release: 1.2.4-SAC — ingest HTTP 201/409/202 # shellcheck shell=bash sac_normalize_mode() { diff --git a/ssh-monitor b/ssh-monitor index 6a86500..55521f7 100644 --- a/ssh-monitor +++ b/ssh-monitor @@ -7,7 +7,7 @@ IFS=$'\n\t' # ============================================ CONFIG_FILE="/etc/ssh-monitor.conf" -SSH_MONITOR_VERSION="1.2.3-SAC" +SSH_MONITOR_VERSION="1.2.4-SAC" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" if [ -f "$SCRIPT_DIR/sac-client.sh" ]; then diff --git a/update_ssh_monitor.sh b/update_ssh_monitor.sh index b362e10..8d22840 100755 --- a/update_ssh_monitor.sh +++ b/update_ssh_monitor.sh @@ -242,6 +242,17 @@ read_ssh_monitor_version() { printf '%s' "$line" } +read_sac_client_version() { + local f="$1" + local line + [ -f "$f" ] || return 0 + line=$(grep -E '^# SAC client release:' "$f" 2>/dev/null | head -1) || return 0 + line=${line#*release: } + line=${line%% —*} + line=${line%% *} + printf '%s' "$line" +} + file_sha256() { sha256sum "$1" 2>/dev/null | awk '{print $1}' || true } @@ -445,7 +456,10 @@ sync_sac_client() { } local_dst="${LOCAL_SCRIPT_PATH%/*}/sac-client.sh" - log_action "sac-client: remote=$remote local=$local_dst" + local remote_ver local_ver + remote_ver="$(read_sac_client_version "$remote")" + local_ver="$(read_sac_client_version "$local_dst")" + log_action "sac-client: remote=$remote ver=${remote_ver:-?} local=$local_dst ver=${local_ver:-?}" remote_sum=$(file_sha256 "$remote") if [ -z "$remote_sum" ]; then SUMMARY_SAC_CLIENT="ошибка" @@ -458,7 +472,7 @@ sync_sac_client() { local_sum=$(file_sha256 "$local_dst") if [ "$local_sum" = "$remote_sum" ]; then SUMMARY_SAC_CLIENT="без изменений" - SUMMARY_SAC_REASON="sha256 совпадает (${local_sum:0:16}…)" + SUMMARY_SAC_REASON="sha256 совпадает; ver=${remote_ver:-?} (${local_sum:0:16}…)" log_action "sac-client.sh: checksum совпадает, копирование не требуется" debug_step "sac-client.sh без изменений" return 0 @@ -479,7 +493,7 @@ sync_sac_client() { chmod 644 "$local_dst" SAC_CLIENT_CHANGED=1 SUMMARY_SAC_CLIENT="обновлён" - SUMMARY_SAC_REASON="sha256 ${remote_sum:0:16}…" + SUMMARY_SAC_REASON="ver ${local_ver:-?} → ${remote_ver:-?}, sha256 ${remote_sum:0:16}…" log_action "sac-client.sh обновлён → $local_dst" if [ "$DEPLOY_MODE" -eq 1 ]; then say_ok "sac-client.sh → $local_dst"