- install.sh always asks for the install directory (--prefix or a prompt with confirmation, no default); refuses system directories, the repository checkout itself, paths inside/containing it and non-empty directories (a resumed install is allowed). A preflight refusal says nothing was changed. - UI is part of the repository: committed build in deploy/ui-dist with SOURCE_HASH and a staleness guard (check-ui.sh, loud warning). install.sh and update.sh resolve the UI: --ui-dist FILE|DIR, --build-ui, committed build; install stops without a UI unless --no-ui. update.sh swaps the UI when its hash differs from the installed one (.ui-source-hash). - build-ui.sh: --docker, --local (host Node >= 20.19, temporary copy), --node-download (portable Node, SHA-256 verified), --publish. - Verified on Alpine 3.23: install without UI options installs the real UI; local build equals the Docker build; update skips an unchanged UI and warns on a stale build. --node-download is untested (needs network). - Docs: Scenario 2 guide, change summary, plan, README. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
40 lines
1.4 KiB
Bash
Executable File
40 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
# Check that the committed UI build (deploy/ui-dist) matches the UI sources (APP_UI).
|
|
#
|
|
# deploy/native/check-ui.sh [REPO_DIR]
|
|
#
|
|
# Prints fresh, stale or missing. Exit code: 0 fresh, 1 stale (the build is older than the sources: run
|
|
# deploy/native/build-ui.sh --publish and commit deploy/ui-dist), 2 missing or not checkable.
|
|
# Run it before a commit or a release that touches APP_UI. It changes nothing.
|
|
# See DOCS/Deployment/Scenario2_System_Services.md
|
|
set -eu
|
|
|
|
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
|
. "$SCRIPT_DIR/lib.sh"
|
|
DEPLOY_LOG=""
|
|
|
|
case "${1:-}" in
|
|
-h|--help) sed -n '2,/^set -eu$/{/^set -eu$/!p}' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
|
esac
|
|
REPO=$(cd "${1:-$ROOT_DIR}" 2>/dev/null && pwd) || { echo "error: directory not found: ${1:-}" >&2; exit 2; }
|
|
|
|
rc=0
|
|
ui_repo_state "$REPO" || rc=1
|
|
if [ "$rc" = 1 ]; then
|
|
echo "error: cannot compute the hash of $REPO/APP_UI (sources missing, or no sha256sum/shasum)" >&2
|
|
exit 2
|
|
fi
|
|
case "$UI_STATE" in
|
|
fresh)
|
|
echo "fresh: deploy/ui-dist matches the APP_UI sources (hash $UI_CUR_HASH)"
|
|
exit 0 ;;
|
|
stale)
|
|
echo "stale: $(ui_stale_lines | head -n 1)"
|
|
ui_stale_lines | sed -n '2,$p' | sed 's/^/ /'
|
|
exit 1 ;;
|
|
*)
|
|
echo "missing: no committed UI build in $REPO/deploy/ui-dist (index.html)"
|
|
echo " Maintainers: run deploy/native/build-ui.sh --publish and commit deploy/ui-dist."
|
|
exit 2 ;;
|
|
esac
|