LibrePortal/scripts/app/containers/getlibreportal/getlibreportal_publish.sh
librelad 8800f524d4 feat(tools): WebUI/CLI publish tool for getlibreportal + weblibreportal
Surface the publish step through the existing Tools system (apps-tools.json -> Tools
tab + 'libreportal app tool <app> publish'), so the docroot can be (re)built from
the WebUI instead of a manual cd + script.

- webui_tools.sh: declare a 'publish' tool (no inputs) for getlibreportal + weblibreportal.
- scripts/app/containers/getlibreportal/getlibreportal_publish.sh (appGetlibreportalPublish):
  runs the host's publish.sh into the served data dir, as the container user (owns it).
- scripts/app/containers/weblibreportal/weblibreportal_publish.sh (appWeblibreportalPublish):
  builds Eleventy as the manager (owns the install tree), then syncs the result into
  the container-user-owned docroot — handling the build-vs-write owner split.
- Both guard for the build prerequisites (repo source / npm / dist) and fail with a
  clear message; regenerated the sourced-file arrays.

Honest status: scaffolding only — wiring verified (dispatch names match, files sourced,
JSON valid) but the end-to-end tool RUN is untested, and it's build-box-only (needs the
repo checkout + npm + a built dist/). These hosting apps are dev-only and headed for a
separate repo; this just sets the automation up so it's ready to iterate on.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-25 21:02:53 +01:00

24 lines
927 B
Bash

#!/bin/bash
# Tool: getlibreportal "publish" — assemble the download host's docroot
# (install.sh + the dist/<channel> release artifacts) into its served data dir.
# Runs as the container user (it owns the data dir); reads the manager-owned
# install tree. Build-box only — needs a populated dist/ (run make_release first).
appGetlibreportalPublish()
{
isHeader "Publish downloads (getlibreportal)"
local app=getlibreportal
local pub="${install_containers_dir}${app}/publish.sh"
local data="${containers_dir}${app}/data"
[[ -f "$pub" ]] || { isError "publish.sh not found at $pub — full repo checkout needed."; return 1; }
runFileOp mkdir -p "$data"
if runFileOp bash "$pub" "$data"; then
isSuccessful "Downloads published. Restart $app to serve it."
else
isError "Publish failed (is dist/ present? run scripts/release/make_release.sh first)."
return 1
fi
}