From 3e1199e2ec9c08ddd69d6214276b8284ae1b0c28 Mon Sep 17 00:00:00 2001 From: PTah Date: Thu, 28 May 2026 13:01:51 +1000 Subject: [PATCH] chore: align ssh monitor and SAC module version 1.2.6-SAC Co-authored-by: Cursor --- README.md | 2 +- readme_eng.md | 2 +- sac-client.sh | 2 +- ssh-monitor | 2 +- update_ssh_monitor.sh | 28 ++++++++++++++++++++-------- version.txt | 1 + 6 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 version.txt diff --git a/README.md b/README.md index a2f50d4..a62803f 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ bash -n ./ssh-monitor ## Релизный архив -Версия задаётся в скрипте переменной **`SSH_MONITOR_VERSION`** (на момент последнего обновления документации — **1.2.2-SAC**; актуальное значение смотрите в файле **`ssh-monitor`**). Сборка tarball из текущего git-дерева: +Версия задаётся в **`SSH_MONITOR_VERSION`** в файле **`ssh-monitor`** и дублируется в **`version.txt`** (сейчас **1.2.6-SAC**). Модуль **`sac-client.sh`** использует ту же версию для SAC `product_version`. Сборка tarball из текущего git-дерева: ```bash make dist diff --git a/readme_eng.md b/readme_eng.md index ee26a28..aab5e82 100644 --- a/readme_eng.md +++ b/readme_eng.md @@ -153,7 +153,7 @@ bash -n ./ssh-monitor ## Release tarball -Version is set in the script as **`SSH_MONITOR_VERSION`** (as of last doc update — **1.2.2-SAC**; see the **`ssh-monitor`** file for the current value). Build from the git tree: +Version is set as **`SSH_MONITOR_VERSION`** in **`ssh-monitor`** and **`version.txt`** (currently **1.2.6-SAC**). **`sac-client.sh`** reports the same version to SAC. Build from the git tree: ```bash make dist diff --git a/sac-client.sh b/sac-client.sh index 5fdf083..37c7da9 100644 --- a/sac-client.sh +++ b/sac-client.sh @@ -1,5 +1,5 @@ # SAC client for ssh-monitor (source from ssh-monitor) -# SAC client release: 1.2.6-SAC — host.display_name from SERVER_DISPLAY_NAME +# Версия для SAC = SSH_MONITOR_VERSION в ssh-monitor (отдельный номер здесь не задаётся). # shellcheck shell=bash sac_normalize_mode() { diff --git a/ssh-monitor b/ssh-monitor index 42718cb..a92fdeb 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.5-SAC" +SSH_MONITOR_VERSION="1.2.6-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 fd87756..d596961 100755 --- a/update_ssh_monitor.sh +++ b/update_ssh_monitor.sh @@ -305,15 +305,24 @@ read_ssh_monitor_version() { printf '%s' "$line" } +# Версия SAC-модуля совпадает с SSH_MONITOR_VERSION основного скрипта в том же каталоге. 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" + local sac_file="$1" + local dir="${sac_file%/*}" + read_ssh_monitor_version "$dir/ssh-monitor" +} + +warn_version_mismatch() { + local repo_ssh="$1" + local repo_ver vt + repo_ver="$(read_ssh_monitor_version "$repo_ssh")" + [ -f "$repo_ssh" ] || return 0 + if [ -f "${repo_ssh%/*}/version.txt" ]; then + vt="$(tr -d '\r\n' < "${repo_ssh%/*}/version.txt")" + if [ -n "$repo_ver" ] && [ -n "$vt" ] && [ "$repo_ver" != "$vt" ]; then + log_action "WARN: SSH_MONITOR_VERSION=$repo_ver != version.txt=$vt" + fi + fi } file_sha256() { @@ -855,6 +864,9 @@ update_script() { actual_script_path="${actual_script_path//$'\n'/}" actual_script_path="${actual_script_path//$'\r'/}" debug_step "Путь к ssh-monitor в клоне: ${actual_script_path:-не найден}" + if [ -n "$actual_script_path" ] && [ -f "$actual_script_path" ]; then + warn_version_mismatch "$actual_script_path" + fi SAC_CLIENT_CHANGED=0 if ! sync_sac_client; then diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..6d70a47 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +1.2.6-SAC