Run daemon on packaged Bare runtime
This commit is contained in:
+16
-9
@@ -1,21 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
NODE_BIN="$(command -v node || true)"
|
||||
if [[ -z "${NODE_BIN}" ]]; then
|
||||
echo "Node.js is required" >&2
|
||||
exit 1
|
||||
fi
|
||||
command -v zip >/dev/null || { echo "zip is required to register the GNOME extension" >&2; exit 1; }
|
||||
APP_DIR="${HOME}/.local/share/jarvis-qvac"
|
||||
EXT_DIR="${HOME}/.local/share/gnome-shell/extensions/[email protected]"
|
||||
CONFIG_DIR="${HOME}/.config/jarvis"
|
||||
CACHE_DIR="${XDG_CACHE_HOME:-${HOME}/.cache}/jarvis/models"
|
||||
mkdir -p "${APP_DIR}" "${EXT_DIR}" "${CONFIG_DIR}" "${HOME}/.config/systemd/user" "${CACHE_DIR}"
|
||||
tar --exclude='.git' --exclude='./.agents' --exclude='./.codex' --exclude='./dist' --exclude='./node_modules' --exclude='*/node_modules' --exclude='*/__pycache__' --exclude='*.pyc' -cf - -C "${ROOT_DIR}" . | tar -xf - -C "${APP_DIR}"
|
||||
if [[ ! -d "${APP_DIR}/node_modules" ]]; then
|
||||
( cd "${APP_DIR}" && npm ci --omit=dev --ignore-scripts )
|
||||
if [[ -f "${ROOT_DIR}/node_modules/bare-runtime-linux-x64/bin/bare" || -f "${ROOT_DIR}/node_modules/bare-runtime-linux-arm64/bin/bare" ]]; then
|
||||
tar --exclude='.git' --exclude='./.agents' --exclude='./.codex' --exclude='./dist' --exclude='./vendor/agent-harness/node_modules' --exclude='*/__pycache__' --exclude='*.pyc' -cf - -C "${ROOT_DIR}" . | tar -xf - -C "${APP_DIR}"
|
||||
else
|
||||
tar --exclude='.git' --exclude='./.agents' --exclude='./.codex' --exclude='./dist' --exclude='./node_modules' --exclude='*/node_modules' --exclude='*/__pycache__' --exclude='*.pyc' -cf - -C "${ROOT_DIR}" . | tar -xf - -C "${APP_DIR}"
|
||||
fi
|
||||
case "$(uname -m)" in
|
||||
x86_64|amd64) BARE_BIN="${APP_DIR}/node_modules/bare-runtime-linux-x64/bin/bare" ;;
|
||||
aarch64|arm64) BARE_BIN="${APP_DIR}/node_modules/bare-runtime-linux-arm64/bin/bare" ;;
|
||||
*) BARE_BIN="" ;;
|
||||
esac
|
||||
if [[ ! -x "${BARE_BIN}" ]]; then BARE_BIN="$(command -v bare || true)"; fi
|
||||
if [[ -z "${BARE_BIN}" || ! -x "${BARE_BIN}" ]]; then
|
||||
echo "The installed bundle does not contain a Bare runtime for $(uname -m). Install the official rolling bundle or build it with npm run package:bare." >&2
|
||||
exit 1
|
||||
fi
|
||||
chmod 755 "${BARE_BIN}"
|
||||
rm -rf "${EXT_DIR}"
|
||||
mkdir -p "${EXT_DIR}"
|
||||
EXT_TMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/jarvis-extension.XXXXXX")"
|
||||
@@ -28,7 +35,7 @@ if command -v gnome-extensions >/dev/null && gnome-extensions install --force "$
|
||||
else
|
||||
cp -a "${ROOT_DIR}/apps/gnome-extension/[email protected]/." "${EXT_DIR}/"
|
||||
fi
|
||||
sed "s#__JARVIS_NODE__#${NODE_BIN}#" "${ROOT_DIR}/packaging/jarvisd.service" > "${HOME}/.config/systemd/user/jarvisd.service"
|
||||
sed "s#__JARVIS_BARE__#${BARE_BIN}#" "${ROOT_DIR}/packaging/jarvisd.service" > "${HOME}/.config/systemd/user/jarvisd.service"
|
||||
if [[ ! -f "${CONFIG_DIR}/qvac.config.json" ]]; then
|
||||
sed "s#__JARVIS_CACHE__#${CACHE_DIR}#g" "${ROOT_DIR}/packaging/qvac.config.template.json" > "${CONFIG_DIR}/qvac.config.json"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user