From d954be13315a6ca548fced78027c7b2578e3917e Mon Sep 17 00:00:00 2001 From: Light1YT Date: Tue, 26 May 2026 08:39:24 +0000 Subject: [PATCH] =?UTF-8?q?fix(auth):=20scripts/auth/*.sh=20=E2=80=94=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20?= =?UTF-8?q?SNIPPET=20path=20(#589)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/auth/add_user.sh | 7 ++++++- scripts/auth/list_users.sh | 5 ++++- scripts/auth/remove_user.sh | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/auth/add_user.sh b/scripts/auth/add_user.sh index e8afa6b6..6232595f 100644 --- a/scripts/auth/add_user.sh +++ b/scripts/auth/add_user.sh @@ -8,7 +8,12 @@ # - НЕ коммитит изменения — это задача разработчика. set -euo pipefail -SNIPPET="$(dirname "$(dirname "$(realpath "$0")")")/caddy/users.caddy.snippet" +# Скрипт лежит в `/scripts/auth/`; snippet — в `/caddy/`. +# Нужно 3× `dirname`: $0 (.../scripts/auth/add_user.sh) → .../scripts/auth → .../scripts → .../. +# Bug fix 2026-05-26 — было 2× dirname (см. [[Bug_AddUser_Sh_Snippet_Path_Fixed]]). +SCRIPT_DIR="$(cd "$(dirname "$(realpath "$0")")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +SNIPPET="$REPO_ROOT/caddy/users.caddy.snippet" usage() { echo "Usage: $0 \"\"" >&2 diff --git a/scripts/auth/list_users.sh b/scripts/auth/list_users.sh index 102d9f1b..e8f7a024 100644 --- a/scripts/auth/list_users.sh +++ b/scripts/auth/list_users.sh @@ -3,7 +3,10 @@ # Usage: ./scripts/auth/list_users.sh set -euo pipefail -SNIPPET="$(dirname "$(dirname "$(realpath "$0")")")/caddy/users.caddy.snippet" +# 3× dirname от $0 (.../scripts/auth/list_users.sh) → repo root. Bug fix 2026-05-26. +SCRIPT_DIR="$(cd "$(dirname "$(realpath "$0")")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +SNIPPET="$REPO_ROOT/caddy/users.caddy.snippet" if [[ ! -f "$SNIPPET" ]]; then echo "ERROR: snippet not found at $SNIPPET" >&2 diff --git a/scripts/auth/remove_user.sh b/scripts/auth/remove_user.sh index 8787a5aa..37796ee9 100644 --- a/scripts/auth/remove_user.sh +++ b/scripts/auth/remove_user.sh @@ -5,7 +5,10 @@ # НЕ коммитит изменения — это задача разработчика. set -euo pipefail -SNIPPET="$(dirname "$(dirname "$(realpath "$0")")")/caddy/users.caddy.snippet" +# 3× dirname от $0 (.../scripts/auth/remove_user.sh) → repo root. Bug fix 2026-05-26. +SCRIPT_DIR="$(cd "$(dirname "$(realpath "$0")")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +SNIPPET="$REPO_ROOT/caddy/users.caddy.snippet" usage() { echo "Usage: $0 " >&2