Let a server service carry helper scripts and timers, starting with UseSend's cert refresh

This commit is contained in:
Gabriel Brown committed 2026-10-30 13:44:29 -04:00
1 parent a987cbab66
commit 95fa480469
9 files changed
+304 -59

No files matched your search

+13 -9
View File
@@ -3,9 +3,12 @@
# Every service in the catalog has the same shape, because panama-server and
# the update timer both depend on it blindly:
#
# * a compose.yml, which is the only file enable symlinks into ~/Server
# * a compose.yml, linked into ~/Server along with any helper script
# * exactly one podman-*.service unit -- its filename is the unit's
# identity, so two would be an ambiguity and zero an unenableable service
# identity, so two would be an ambiguity and zero an unenableable service.
# Other *.service and *.timer files are helpers (a cert refresh, say)
# that enable links beside it; each helper service needs a timer or a
# unit that pulls it in, so an orphan helper is flagged
# * a WorkingDirectory of %h/Server/<Name>, matching the directory enable
# creates -- a unit pointing anywhere else starts compose against a
# directory that has no .env and no data
@@ -31,20 +34,21 @@ for dir in "$containers_dir"/*/; do
[[ -f "$dir/compose.yml" ]] || note "$name has no compose.yml"
units=("$dir"/*.service)
units=("$dir"/podman-*.service)
if (( ${#units[@]} == 0 )); then
note "$name has no unit file"
note "$name has no podman-<name>.service unit"
continue
elif (( ${#units[@]} > 1 )); then
note "$name has ${#units[@]} unit files; its identity is ambiguous"
note "$name has ${#units[@]} podman-*.service units; its identity is ambiguous"
continue
fi
unit="${units[0]}"
case "$(basename "$unit")" in
podman-*.service) ;;
*) note "$name's unit is not named podman-<name>.service: $(basename "$unit")" ;;
esac
for helper in "$dir"/*.service; do
[[ "$helper" == "$unit" ]] && continue
[[ -f "${helper%.service}.timer" ]] \
|| note "$name's helper $(basename "$helper") has no matching .timer"
done
grep -q "^WorkingDirectory=%h/Server/$name\$" "$unit" \
|| note "$name's unit does not work in %h/Server/$name"