feat(wg): install + enable the WireGuard status collector timer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feat/v1-foundation
boban 2026-06-20 23:30:47 +02:00
parent 3d73489717
commit 9aabd7fce5
1 changed files with 8 additions and 2 deletions

View File

@ -288,6 +288,7 @@ install_host_watchers() {
local tmp_path tmp_svc tmp_upath tmp_usvc local tmp_path tmp_svc tmp_upath tmp_usvc
tmp_path="$(mktemp)"; tmp_svc="$(mktemp)"; tmp_upath="$(mktemp)"; tmp_usvc="$(mktemp)" tmp_path="$(mktemp)"; tmp_svc="$(mktemp)"; tmp_upath="$(mktemp)"; tmp_usvc="$(mktemp)"
local tmp_gate; tmp_gate="$(mktemp)" local tmp_gate; tmp_gate="$(mktemp)"
local tmp_csvc tmp_ctimer; tmp_csvc="$(mktemp)"; tmp_ctimer="$(mktemp)"
# Restart units run as the clusev user. # Restart units run as the clusev user.
sed "s#/home/nexxo/clusev#${proj}#g" "${src}/clusev-restart.path" > "$tmp_path" sed "s#/home/nexxo/clusev#${proj}#g" "${src}/clusev-restart.path" > "$tmp_path"
sed -e "s#/home/nexxo/clusev#${proj}#g" -e "s/^User=.*/User=clusev/" "${src}/clusev-restart.service" > "$tmp_svc" sed -e "s#/home/nexxo/clusev#${proj}#g" -e "s/^User=.*/User=clusev/" "${src}/clusev-restart.service" > "$tmp_svc"
@ -296,20 +297,25 @@ install_host_watchers() {
sed "s#/home/nexxo/clusev#${proj}#g" "${src}/clusev-update.service" > "$tmp_usvc" sed "s#/home/nexxo/clusev#${proj}#g" "${src}/clusev-update.service" > "$tmp_usvc"
# Gate unit keeps User=root; only the path is rewritten. # Gate unit keeps User=root; only the path is rewritten.
sed "s#/home/nexxo/clusev#${proj}#g" "docker/wg/clusev-wg-gate.service" > "$tmp_gate" sed "s#/home/nexxo/clusev#${proj}#g" "docker/wg/clusev-wg-gate.service" > "$tmp_gate"
sed "s#/home/nexxo/clusev#${proj}#g" "docker/wg/clusev-wg-collect.service" > "$tmp_csvc"
sed "s#/home/nexxo/clusev#${proj}#g" "docker/wg/clusev-wg-collect.timer" > "$tmp_ctimer"
if install -m 0644 "$tmp_path" "${dst}/clusev-restart.path" \ if install -m 0644 "$tmp_path" "${dst}/clusev-restart.path" \
&& install -m 0644 "$tmp_svc" "${dst}/clusev-restart.service" \ && install -m 0644 "$tmp_svc" "${dst}/clusev-restart.service" \
&& install -m 0644 "$tmp_upath" "${dst}/clusev-update.path" \ && install -m 0644 "$tmp_upath" "${dst}/clusev-update.path" \
&& install -m 0644 "$tmp_usvc" "${dst}/clusev-update.service" \ && install -m 0644 "$tmp_usvc" "${dst}/clusev-update.service" \
&& install -m 0644 "$tmp_gate" "${dst}/clusev-wg-gate.service" \ && install -m 0644 "$tmp_gate" "${dst}/clusev-wg-gate.service" \
&& install -m 0644 "$tmp_csvc" "${dst}/clusev-wg-collect.service" \
&& install -m 0644 "$tmp_ctimer" "${dst}/clusev-wg-collect.timer" \
&& systemctl daemon-reload \ && systemctl daemon-reload \
&& systemctl enable --now clusev-restart.path \ && systemctl enable --now clusev-restart.path \
&& systemctl enable --now clusev-update.path \ && systemctl enable --now clusev-update.path \
&& systemctl enable clusev-wg-gate.service; then && systemctl enable clusev-wg-gate.service \
&& systemctl enable --now clusev-wg-collect.timer; then
info "Host-Watcher aktiv (clusev-restart.path User=clusev, clusev-update.path User=root)" info "Host-Watcher aktiv (clusev-restart.path User=clusev, clusev-update.path User=root)"
else else
warn "Host-Watcher konnten nicht installiert werden — siehe ${src}/README.md." warn "Host-Watcher konnten nicht installiert werden — siehe ${src}/README.md."
fi fi
rm -f "$tmp_path" "$tmp_svc" "$tmp_upath" "$tmp_usvc" "$tmp_gate" rm -f "$tmp_path" "$tmp_svc" "$tmp_upath" "$tmp_usvc" "$tmp_gate" "$tmp_csvc" "$tmp_ctimer"
} }
install_host_watchers install_host_watchers