#!/usr/bin/env bash # # Assemble the getlibreportal docroot — the bootstrap installer + release channels # — into the served data dir. (The website is a separate app: weblibreportal.) # Run on a full repo checkout (it reads ../../dist, which is host-side). # # Usage: publish.sh [TARGET_DIR] # TARGET_DIR defaults to ./data (next to this script). On a host where the app # is installed, pass its live data dir, e.g.: # containers/getlibreportal/publish.sh /libreportal-containers/getlibreportal/data # # Layout produced: # /install.sh ← bootstrap installer (repo: install.sh) # //… ← release manifests + tarballs (repo: dist//) set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ROOT="$(cd "$HERE/../.." && pwd)" # repo root (containers/getlibreportal -> ../../) TARGET="${1:-$HERE/data}" echo "Assembling getlibreportal docroot -> $TARGET" mkdir -p "$TARGET" rm -rf "${TARGET:?}"/* "${TARGET:?}"/.??* 2>/dev/null || true # 1. Bootstrap installer. if [[ -f "$ROOT/install.sh" ]]; then cp -f "$ROOT/install.sh" "$TARGET/install.sh"; echo " ✓ install.sh"; fi # 2. Release channels (from scripts/release/make_release.sh). if [[ -d "$ROOT/dist" ]]; then for ch in "$ROOT/dist"/*/; do [[ -d "$ch" ]] || continue n="$(basename "$ch")"; mkdir -p "$TARGET/$n"; cp -f "$ch"/* "$TARGET/$n/" 2>/dev/null || true echo " ✓ channel $n" done else echo " ! no dist/ — run scripts/release/make_release.sh first" fi echo "Done. Restart the container to serve it."