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