refactor(pack): template CustomSkinLoader + unify pack rendering

Add tooling/render-pack.sh: renders all pack/**/*.tmpl with ${BASE_DOMAIN}
(no dnsmasq HOST_LAN_IP coupling) and rebuilds the packwiz index. Both
render-config.sh and add-custom-mod.sh now delegate to it.

CustomSkinLoader.json's skin API roots are no longer frozen — it becomes
CustomSkinLoader.json.tmpl, rendered like the mod metadata. .packwizignore
broadened to *.tmpl; rendered .json gitignored as build output.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-07 22:42:32 +02:00
parent 853405afe7
commit 6e91749f59
7 changed files with 47 additions and 34 deletions

View File

@@ -20,18 +20,6 @@ render() { # $1=template $2=output
render drasl/config/config.toml.tmpl drasl/config/config.toml
render dnsmasq/dnsmasq.conf.tmpl dnsmasq/dnsmasq.conf
# packwiz external-file metadata: render every pack/mods/*.pw.toml.tmpl into its
# .pw.toml (injects ${BASE_DOMAIN} into the download URL), then rebuild the
# packwiz index. .packwizignore keeps the .tmpl out of the index.
shopt -s nullglob
tmpls=(pack/mods/*.pw.toml.tmpl)
shopt -u nullglob
if [ "${#tmpls[@]}" -gt 0 ]; then
for t in "${tmpls[@]}"; do render "$t" "${t%.tmpl}"; done
command -v packwiz >/dev/null 2>&1 || { echo "packwiz not found — cannot refresh index" >&2; exit 1; }
# index.toml is gitignored build output; seed a minimal one so packwiz refresh
# (which won't bootstrap a missing index) has something to populate.
[ -f pack/index.toml ] || printf 'hash-format = "sha256"\n' > pack/index.toml
( cd pack && packwiz refresh )
echo "refreshed packwiz index (${#tmpls[@]} external metafiles)"
fi
# pack templates (mods/*.pw.toml.tmpl, CustomSkinLoader, …) + packwiz index.
# Delegated to render-pack.sh (BASE_DOMAIN only — single source of pack render).
tooling/render-pack.sh