aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/build/build-hub.sh
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-31 10:49:45 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-31 10:49:45 +0200
commit8d5c564e75ad2928e77ea66decc979366ca5ccd5 (patch)
tree7f88ceb2ccd838011bb2f399f148c7f9b39f75ec /packaging/build/build-hub.sh
parent0c2754d2d4cb1905d5e324f56fbc64e4afae526f (diff)
downloadmeshbay-8d5c564e75ad2928e77ea66decc979366ca5ccd5.tar.gz
feat(packaging): 4-package .deb/.rpm build system under /opt
Shared venv architecture: meshbay-common owns the Python venv with all pip deps pre-installed; hub and node add only their code into it. Client is a standalone Electron app. No pip runs at install time. - Add build scripts (packaging/build/) for common, hub, node, client - Add orchestrator build-packages.sh with deb/rpm auto-detection - Add .deb control/postinst for all 4 packages - Add .rpm specs for all 4 packages (replaces python3-meshbay-common) - Add Gnome .desktop launcher and icon resizing - Add firewalld services (meshbay-cast, meshbay-node) and UFW profiles - Update systemd units to use /opt/meshbay-common/venv/bin/ paths - TMDB token baked into node package at build time via QE/node.env - Fix package-lock.json sync for protobufjs override Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'packaging/build/build-hub.sh')
-rwxr-xr-xpackaging/build/build-hub.sh73
1 files changed, 73 insertions, 0 deletions
diff --git a/packaging/build/build-hub.sh b/packaging/build/build-hub.sh
new file mode 100755
index 0000000..45d2ab9
--- /dev/null
+++ b/packaging/build/build-hub.sh
@@ -0,0 +1,73 @@
+#!/usr/bin/env bash
+# Build the meshbay-hub package: hub-specific files on top of meshbay-common.
+#
+# Expects build-common.sh to have run first (shared venv exists in staging).
+#
+# Usage: ./build-hub.sh [staging-dir]
+set -euo pipefail
+
+REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+STAGING="${1:-/tmp/meshbay-build}"
+COMMON_ROOT="$STAGING/meshbay-common-root"
+ROOT="$STAGING/meshbay-hub-root"
+
+VENV="$COMMON_ROOT/opt/meshbay-common/venv"
+PYVER=$(basename "$VENV"/lib/python3.*)
+SITE="$VENV/lib/$PYVER/site-packages"
+
+VERSION=$(python3 -c "
+import tomllib, pathlib
+p = pathlib.Path('$REPO/packages/meshbay-hub/pyproject.toml')
+print(tomllib.loads(p.read_text())['project']['version'])
+")
+echo "==> meshbay-hub $VERSION"
+
+[ -d "$VENV" ] || { echo "!! shared venv not found — run build-common.sh first" >&2; exit 1; }
+
+rm -rf "$ROOT"
+mkdir -p "$ROOT"
+
+# --- Hub code in the shared venv (owned by meshbay-hub package) -----------
+# MOVE (not copy) from the common staging tree so dpkg/rpm knows these files
+# belong to meshbay-hub, not meshbay-common. build-common.sh installed them
+# so that shebangs and dependency resolution are correct.
+HUB_ROOT="$ROOT/opt/meshbay-common/venv/lib/$PYVER/site-packages"
+mkdir -p "$HUB_ROOT"
+mv "$SITE/meshbay_hub" "$HUB_ROOT/"
+mv "$SITE"/meshbay_hub-*.dist-info "$HUB_ROOT/"
+
+# Entry point
+mkdir -p "$ROOT/opt/meshbay-common/venv/bin"
+mv "$VENV/bin/meshbay-hub" "$ROOT/opt/meshbay-common/venv/bin/"
+
+# Symlink in PATH
+mkdir -p "$ROOT/usr/bin"
+ln -sf /opt/meshbay-common/venv/bin/meshbay-hub "$ROOT/usr/bin/meshbay-hub"
+
+# --- Hub-specific assets --------------------------------------------------
+mkdir -p "$ROOT/opt/meshbay-hub"
+
+# Alembic config (migrations are inside the installed package at meshbay_hub/db/migrations/)
+if [ -f "$REPO/packages/meshbay-hub/alembic.ini" ]; then
+ mkdir -p "$ROOT/opt/meshbay-hub/migrations"
+ cp "$REPO/packages/meshbay-hub/alembic.ini" "$ROOT/opt/meshbay-hub/migrations/"
+fi
+
+# Config example
+mkdir -p "$ROOT/opt/meshbay-hub/share"
+if [ -f "$REPO/packaging/conf/hub.toml.example" ]; then
+ cp "$REPO/packaging/conf/hub.toml.example" "$ROOT/opt/meshbay-hub/share/"
+fi
+
+# Also install to /etc/meshbay/ for discoverability
+mkdir -p "$ROOT/etc/meshbay"
+if [ -f "$ROOT/opt/meshbay-hub/share/hub.toml.example" ]; then
+ cp "$ROOT/opt/meshbay-hub/share/hub.toml.example" "$ROOT/etc/meshbay/"
+fi
+
+# --- Systemd unit ---------------------------------------------------------
+mkdir -p "$ROOT/usr/lib/systemd/system"
+cp "$REPO/packaging/systemd/meshbay-hub.service" \
+ "$ROOT/usr/lib/systemd/system/meshbay-hub.service"
+
+echo "==> meshbay-hub staging ready at $ROOT"