#!/bin/bash # Stage a lean per-site bundle next to ShopDBFlask.iss, ready for Inno Setup. # # The bundle is built FOR ONE SITE from its plugin profile (ADR-013): plugins the # site did not choose are absent from the payload entirely. Build one installer # per site, not one universal installer. # # Usage: build-installer.sh [repo-path] # # The wheelhouse cannot be built here. Wheels are cp314 win_amd64 and must be # produced ON Windows with the matching Python: # pip download -r requirements.txt -d wheels --only-binary=:all: # Copy that wheels\ directory in before compiling. set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROFILE="${1:?usage: build-installer.sh [repo-path]}" REPO="${2:-$HOME/projects/shopdb-flask}" BUNDLE="$HERE/bundle" [ -f "$PROFILE" ] || { echo "profile not found: $PROFILE"; exit 1; } [ -d "$REPO" ] || { echo "repo not found: $REPO"; exit 1; } echo "==> Staging lean app tree from $PROFILE" rm -rf "$BUNDLE/app" bash "$REPO/scripts/build-site.sh" "$PROFILE" "$BUNDLE/app" # build-site.sh emits the SPA as frontend-dist; the installer's web.config and # static route expect frontend\dist. if [ -d "$BUNDLE/app/frontend-dist" ]; then mkdir -p "$BUNDLE/app/frontend" rm -rf "$BUNDLE/app/frontend/dist" mv "$BUNDLE/app/frontend-dist" "$BUNDLE/app/frontend/dist" fi # The /shopdb-based build, used when the operator picks the subpath deployment. if [ -d "$BUNDLE/app/frontend-dist-subpath" ]; then rm -rf "$BUNDLE/app/frontend/dist-subpath" mv "$BUNDLE/app/frontend-dist-subpath" "$BUNDLE/app/frontend/dist-subpath" fi # Tell the .iss which plugins this bundle actually carries, so the wizard's # plugin page always matches the payload instead of a hand-maintained list. echo "==> Writing plugins.iss" PLUGINS=$(ls "$BUNDLE/app/plugins" 2>/dev/null | tr '\n' ',' | sed 's/,$//') # The subpath SPA is built with its base path compiled in, so whether the wizard # can OFFER a subpath install is a property of the bundle, not a runtime choice. SUBPATH_ALIAS_BUILT="" if [ -f "$BUNDLE/app/frontend/dist-subpath/.alias" ]; then SUBPATH_ALIAS_BUILT="$(cat "$BUNDLE/app/frontend/dist-subpath/.alias")" fi cat > "$HERE/plugins.iss" < Copying installer scripts" mkdir -p "$BUNDLE" cp "$HOME/Downloads/shopdb-install.ps1" "$HOME/Downloads/shopdb-preflight.ps1" "$BUNDLE/" echo "" echo "Bundle staged at: $BUNDLE" for d in app wheels python httpplatformhandler mysql; do if [ -d "$BUNDLE/$d" ]; then printf ' %-20s %s\n' "$d" "$(du -sh "$BUNDLE/$d" | cut -f1)" else printf ' %-20s MISSING\n' "$d" fi done echo "" echo " plugins shipped: $(ls "$BUNDLE/app/plugins" 2>/dev/null | tr '\n' ' ')" echo "" echo "Missing pieces must be added by hand before compiling:" echo " wheels\\ built ON Windows (cp314 win_amd64), ~47 wheels" echo " python\\ python-3.14.6-amd64.exe" echo " httpplatformhandler\\ httpPlatformHandler_amd64.msi" echo " mysql\\ mysql-8.0.46-winx64.msi (bundled-database option only)" echo "" echo "Then compile on Windows: iscc ShopDBFlask.iss"