84b388fae2
文件推送与文件管理对齐:非 root 默认 auto_sudo 时使用 sudo -n rsync; 新增批量 sudoers 补丁脚本以补全 rsync 白名单。
25 lines
813 B
Bash
25 lines
813 B
Bash
#!/usr/bin/env bash
|
|
# Batch patch nexus-files sudoers on sub-servers (rsync for file push elevation).
|
|
#
|
|
# Usage:
|
|
# bash scripts/batch_patch_files_sudoers.sh --name 温胜夜
|
|
# bash scripts/batch_patch_files_sudoers.sh --non-root-only --limit 100
|
|
# bash scripts/batch_patch_files_sudoers.sh --ids 12,34 --dry-run
|
|
#
|
|
# Run on machine with .env (local dev or ssh nexus + cd /opt/nexus).
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
SECRETS="${ROOT}/deploy/nexus-1panel.secrets.sh"
|
|
if [[ -f "$SECRETS" ]]; then
|
|
# shellcheck disable=SC1090
|
|
source "$SECRETS"
|
|
fi
|
|
PYTHON="${ROOT}/.venv/bin/python"
|
|
if [[ ! -x "$PYTHON" ]]; then
|
|
PYTHON="${ROOT}/venv/bin/python"
|
|
fi
|
|
if [[ ! -x "$PYTHON" ]]; then
|
|
PYTHON=python3
|
|
fi
|
|
exec "$PYTHON" "${ROOT}/scripts/batch_patch_files_sudoers.py" "$@"
|