mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
Replaces inline `applications`/`users` merging with dedicated lookup plugins and runtime hydration. Introduces `add_csp_hash` filter, integrates sort into `find_dock_val_by_bkp_entr`, splits the Keycloak one-shot realm import into `05a_realm_import_run.yml`, and fixes the Mastodon administrator task YAML. Removes obsolete `csp_hashes` filter, `sys-token-store` Jinja filter, and empty CLI setup modules. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
82 lines
2.2 KiB
Bash
Executable File
82 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
echo "🔧 Running project setup (no installation)"
|
|
|
|
# ------------------------------------------------------------
|
|
# Hard-coded configuration (NOT overridable)
|
|
# ------------------------------------------------------------
|
|
# Prefer Makefile-provided venv interpreter (exported as PYTHON).
|
|
# Fallback to python3 if not set.
|
|
: "${PYTHON:?PYTHON must be set by Makefile (venv python3)}"
|
|
|
|
# Optional: show interpreter for debugging
|
|
echo "🐍 Using PYTHON=${PYTHON}"
|
|
if command -v "${PYTHON}" >/dev/null 2>&1; then
|
|
"${PYTHON}" -c 'import sys; print("sys.executable=", sys.executable)' || true
|
|
fi
|
|
|
|
ROLES_DIR="./roles"
|
|
|
|
INCLUDES_SCRIPT="./cli/build/role_include/__main__.py"
|
|
INCLUDES_OUT_DIR="./tasks/groups"
|
|
|
|
# ------------------------------------------------------------
|
|
# Validation
|
|
# ------------------------------------------------------------
|
|
require_file() {
|
|
local path="$1"
|
|
[[ -f "$path" ]] || {
|
|
echo "❌ File not found: $path" >&2
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
require_dir() {
|
|
local path="$1"
|
|
[[ -d "$path" ]] || {
|
|
echo "❌ Directory not found: $path" >&2
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
require_cmd() {
|
|
command -v "$1" >/dev/null || {
|
|
echo "❌ Command not found: $1" >&2
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
require_cmd "${PYTHON}"
|
|
require_dir "${ROLES_DIR}"
|
|
require_file "${INCLUDES_SCRIPT}"
|
|
|
|
# ------------------------------------------------------------
|
|
# Helpers
|
|
# ------------------------------------------------------------
|
|
log_section() {
|
|
echo
|
|
echo "------------------------------------------------------------"
|
|
echo "$1"
|
|
echo "------------------------------------------------------------"
|
|
}
|
|
|
|
# ------------------------------------------------------------
|
|
# Role include files
|
|
# ------------------------------------------------------------
|
|
log_section "🧩 Generating role include files"
|
|
mkdir -p "${INCLUDES_OUT_DIR}"
|
|
|
|
mapfile -t INCLUDE_GROUPS < <("${PYTHON}" -m cli.meta.categories.invokable -s "-")
|
|
|
|
for grp in "${INCLUDE_GROUPS[@]}"; do
|
|
[[ -z "${grp}" ]] && continue
|
|
out="${INCLUDES_OUT_DIR}/${grp}roles.yml"
|
|
echo "→ Building ${out} (pattern: '${grp}')"
|
|
"${PYTHON}" "${INCLUDES_SCRIPT}" "${ROLES_DIR}" -p "${grp}" -o "${out}"
|
|
echo " ✅ ${out}"
|
|
done
|
|
|
|
echo
|
|
echo "🎉 Project setup completed"
|