Add modular setup framework (lib + services + dispatcher) and glow

Introduce the modular post-install structure chosen for reconciling 'one
source of truth' with 'run just the service I want':

- lib/common.sh: shared helpers (logging, prompts, ownership, Caddy wiring) and
  a service registry. Single implementation of each helper.
- setup.sh: dispatcher — interactive menu, run-one (./setup.sh <name>), --list,
  --dry-run, --unattended. Sources lib + services/*.sh (self-registering).
- services/base.sh: essential CLI packages incl. glow (Charm apt repo).
- services/homeassistant.sh: first migrated service (bridge/host networking,
  trusted_proxies, Caddy integration).
- MODULAR.md: architecture, how to add a module, migration status.
- Groups: base/homelab/gaming/backup. Gaming group makes this a base for
  homelab OR gaming boxes.

Also add glow as a default app to the live -crowdsec scripts' essential
packages so it's installed today regardless of entry point.

Verified: bash -n on all new files; ./setup.sh --list groups services;
dry-run run-one routes correctly.

https://claude.ai/code/session_017eA2qqq9jfF2tNtpUYL8vK
This commit is contained in:
Claude
2026-06-03 12:57:12 +00:00
parent d528cfbea3
commit d7b9f935c2
7 changed files with 615 additions and 0 deletions
+17
View File
@@ -1741,6 +1741,23 @@ run_cmd apt install -y \
unzip \
rclone || echo "Warning: Some utilities failed to install, continuing..."
# Install glow (terminal markdown reader) from the Charm apt repo
echo ""
echo "Installing glow (terminal markdown reader)..."
if command -v glow >/dev/null 2>&1; then
echo " ✓ glow already installed"
elif [ "$DRY_RUN" = true ]; then
echo "[DRY-RUN] Would add repo.charm.sh apt repo and install glow"
else
sudo mkdir -p /etc/apt/keyrings
if curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor --yes -o /etc/apt/keyrings/charm.gpg; then
echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list >/dev/null
sudo apt update -y && sudo apt install -y glow && echo " ✓ glow installed" || echo " ⚠ glow install failed"
else
echo " ⚠ Could not fetch Charm signing key - skipping glow"
fi
fi
# Install OpenSSH Server
echo ""
echo "Installing OpenSSH Server..."