Files
gnome-jarvis/packaging/build-runtime-bundle.sh
T
snxravenandCursor c88062ba69
Rolling release / release (push) Failing after 6m40s
Ship the Bare ELF in the release and stop baking host paths into the service.
The rolling bundle already contains the runtime binary. The installer now starts that file through a relative launcher, and the checkout unit is no longer packed for other users.

Co-authored-by: Cursor <[email protected]>
2026-09-14 12:29:26 -04:00

50 lines
2.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
OUT_DIR="${ROOT_DIR}/dist"
case "$(uname -m)" in
x86_64|amd64) PLATFORM="linux-x64" ;;
aarch64|arm64) PLATFORM="linux-arm64" ;;
*) echo "Unsupported host architecture: $(uname -m)" >&2; exit 2 ;;
esac
BINARY="${ROOT_DIR}/node_modules/bare-runtime-${PLATFORM}/bin/bare"
[[ -f "${BINARY}" ]] || { echo "Bare platform binary missing; run npm ci first." >&2; exit 1; }
chmod 755 "${BINARY}"
python3 "${ROOT_DIR}/packaging/prepare-bare-deps.py" "${ROOT_DIR}/node_modules"
mkdir -p "${OUT_DIR}"
BUNDLE_DIR="${OUT_DIR}/jarvis-qvac-bare-${PLATFORM}"
rm -rf "${BUNDLE_DIR}" "${OUT_DIR}/jarvis-qvac-bare-${PLATFORM}.tar.gz"
mkdir -p "${BUNDLE_DIR}"
# The checkout unit points at a developer tree and Node. Do not ship it.
tar --exclude='.git' --exclude='./.agents' --exclude='./.codex' --exclude='./dist' --exclude='./systemd' --exclude='./vendor/agent-harness/node_modules' --exclude='*/__pycache__' --exclude='*.pyc' -cf - -C "${ROOT_DIR}" . | tar -xf - -C "${BUNDLE_DIR}"
cp -a "${ROOT_DIR}/node_modules" "${BUNDLE_DIR}/"
# QVAC publishes one package containing native prebuilds for every supported
# platform. The rolling asset is architecture-specific: retain all Linux x64
# GPU variants, and remove arm64/mobile/Apple/Windows payloads before packing.
find "${BUNDLE_DIR}/node_modules" -type d -name prebuilds -prune -print0 | while IFS= read -r -d '' prebuilds; do
find "${prebuilds}" -mindepth 1 -maxdepth 1 -type d ! -name "${PLATFORM}" -exec rm -rf {} +
done
find "${BUNDLE_DIR}/node_modules" -maxdepth 1 -type d -name 'bare-runtime-*' ! -name "bare-runtime-${PLATFORM}" -exec rm -rf {} +
if [[ -d "${BUNDLE_DIR}/node_modules/@esbuild" ]]; then
find "${BUNDLE_DIR}/node_modules/@esbuild" -mindepth 1 -maxdepth 1 -type d ! -name 'linux-x64' -exec rm -rf {} +
fi
(cd "${BUNDLE_DIR}" && bash packaging/bare-launch.sh packaging/bare-run.js packaging/voice-runtime-smoke.js)
if [[ "${JARVIS_VERIFY_VOICE_MODELS:-0}" == "1" ]]; then
(cd "${BUNDLE_DIR}" && bash packaging/bare-launch.sh packaging/bare-run.js packaging/voice-model-smoke.js)
fi
chmod 755 "${BUNDLE_DIR}/packaging/jarvisd-launch.sh" "${BUNDLE_DIR}/node_modules/bare-runtime-${PLATFORM}/bin/bare"
tar -C "${OUT_DIR}" -czf "${OUT_DIR}/jarvis-qvac-bare-${PLATFORM}.tar.gz" "jarvis-qvac-bare-${PLATFORM}"
rm -rf "${BUNDLE_DIR}"
ARCHIVE="${OUT_DIR}/jarvis-qvac-bare-${PLATFORM}.tar.gz"
MEMBER="jarvis-qvac-bare-${PLATFORM}/node_modules/bare-runtime-${PLATFORM}/bin/bare"
if ! tar -tzf "${ARCHIVE}" | grep -qx "${MEMBER}"; then
echo "Release archive is missing the Bare runtime executable: ${MEMBER}" >&2
exit 1
fi
if tar -tzf "${ARCHIVE}" | grep -q 'systemd/user/jarvisd.service'; then
echo "Release archive still contains the developer systemd unit." >&2
exit 1
fi
echo "Packaged Bare runtime ${MEMBER}"
echo "${ARCHIVE}"