Files
gnome-jarvis/packaging/first-run.sh
T
snxraven 65efad934b
Rolling release / release (push) Successful in 8m25s
CI / verify (push) Successful in 1m24s
Fix installer host integration
2026-09-11 15:20:39 -04:00

51 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "${ROOT_DIR}"
echo "JARVIS-QVAC first-run setup"
echo "The daemon is GPU-gated and keeps QVAC behind one master owner."
echo
echo "[1/5] GPU and QVAC preflight"
npm run gpu-doctor || true
if command -v timeout >/dev/null; then
timeout --foreground 30s npm run qvac:doctor || echo "QVAC doctor timed out or reported an unavailable host dependency; continuing with local setup."
else
npm run qvac:doctor || true
fi
echo
echo "[2/5] Microphone and PipeWire preflight"
npm run voice-doctor || true
echo
echo "[3/5] Wake phrase and model profile"
read -r -p "Wake phrase [hey jarvis]: " WAKE_PHRASE
WAKE_PHRASE="${WAKE_PHRASE:-hey jarvis}"
read -r -p "Model profile [laptop-8gb/laptop-16gb/desktop-gpu] (default: laptop-16gb): " MODEL_PROFILE
MODEL_PROFILE="${MODEL_PROFILE:-laptop-16gb}"
case "${MODEL_PROFILE}" in
laptop-8gb|laptop-16gb|desktop-gpu) ;;
*) echo "Unknown model profile: ${MODEL_PROFILE}" >&2; exit 2 ;;
esac
read -r -p "Enable TTS preview? [Y/n]: " TTS_CHOICE
TTS_ENABLED=true
[[ "${TTS_CHOICE:-Y}" =~ ^[Nn]$ ]] && TTS_ENABLED=false
mkdir -p "${HOME}/.config/jarvis"
node -e 'const fs=require("fs"); const p=process.argv[1], phrase=process.argv[2], profile=process.argv[3], tts=process.argv[4]==="true"; let c={}; try{c=JSON.parse(fs.readFileSync(p,"utf8"))}catch{}; Object.assign(c,{wakePhrase:phrase,modelProfile:profile,ttsEnabled:tts}); fs.writeFileSync(p,JSON.stringify(c,null,2)+"\n")' "${HOME}/.config/jarvis/config.json" "${WAKE_PHRASE}" "${MODEL_PROFILE}" "${TTS_ENABLED}"
echo "Saved wake phrase: ${WAKE_PHRASE}; model profile: ${MODEL_PROFILE}; TTS: ${TTS_ENABLED}"
echo
echo "[4/5] TTS preview"
if [[ "${TTS_ENABLED}" == true && -n "${DBUS_SESSION_BUS_ADDRESS:-}" ]]; then
busctl --user call io.qvac.Jarvis /io/qvac/Jarvis io.qvac.Jarvis.Session Say s "JARVIS local voice preview" || true
else
echo "Session D-Bus is unavailable or TTS is disabled; preview skipped."
fi
echo
echo "[5/5] Typed smoke test"
read -r -p "Type a test prompt (default: say hello): " PROMPT
PROMPT="${PROMPT:-say hello}"
if command -v busctl >/dev/null && [[ -n "${DBUS_SESSION_BUS_ADDRESS:-}" ]]; then
busctl --user call io.qvac.Jarvis /io/qvac/Jarvis io.qvac.Jarvis.Session Ask s "${PROMPT}" || true
else
echo "Session D-Bus is unavailable; saved setup and skipped live prompt."
fi
echo "First-run setup complete. Start with: systemctl --user enable --now jarvisd.service"