Update Installer
Rolling release / release (push) Canceled after 6m21s

This commit is contained in:
2026-09-11 21:28:44 -04:00
parent 9e76928045
commit bd34ec49aa
5 changed files with 178 additions and 18 deletions
+62 -11
View File
@@ -6,12 +6,58 @@ APP_DIR="${HOME}/.local/share/jarvis-qvac"
EXT_DIR="${XDG_DATA_HOME:-${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}"
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}"
APP_PARENT="$(dirname "${APP_DIR}")"
mkdir -p "${APP_PARENT}" "${CONFIG_DIR}" "${HOME}/.config/systemd/user" "${CACHE_DIR}"
STAGING=""
EXT_TMP_DIR=""
cleanup_install() { rm -rf "${STAGING}" "${EXT_TMP_DIR}"; }
trap cleanup_install EXIT
has_bundled_bare() {
[[ -f "${ROOT_DIR}/node_modules/bare-runtime-linux-x64/bin/bare" || -f "${ROOT_DIR}/node_modules/bare-runtime-linux-arm64/bin/bare" ]]
}
extract_tree() {
local dest="$1"
mkdir -p "${dest}"
if has_bundled_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 "${dest}"
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 "${dest}"
fi
}
PREVIOUSLY_ACTIVE=false
if command -v systemctl >/dev/null; then
if systemctl --user is-active --quiet jarvisd.service 2>/dev/null; then
PREVIOUSLY_ACTIVE=true
systemctl --user stop jarvisd.service || true
fi
fi
if [[ -e "${APP_DIR}" || -e "${EXT_DIR}" ]]; then
echo "Cleaning the previous JARVIS-QVAC install so this upgrade is a clean replacement."
fi
if command -v gnome-extensions >/dev/null; then
gnome-extensions disable [email protected] >/dev/null 2>&1 || true
gnome-extensions uninstall [email protected] >/dev/null 2>&1 || true
fi
rm -rf "${EXT_DIR}"
shopt -s nullglob
for leftover in "${APP_PARENT}"/jarvis-qvac.staging.*; do
rm -rf "${leftover}"
done
shopt -u nullglob
STAGING="$(mktemp -d "${APP_PARENT}/jarvis-qvac.staging.XXXXXX")"
extract_tree "${STAGING}"
rm -rf "${APP_DIR}"
mv "${STAGING}" "${APP_DIR}"
STAGING=""
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" ;;
@@ -25,11 +71,8 @@ fi
chmod 755 "${BARE_BIN}"
EXT_TMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/jarvis-extension.XXXXXX")"
EXT_ZIP="${EXT_TMP_DIR}/jarvis-extension.zip"
cleanup_ext() { rm -rf "${EXT_TMP_DIR}"; }
trap cleanup_ext EXIT
( cd "${ROOT_DIR}/apps/gnome-extension/[email protected]" && zip -q -r "${EXT_ZIP}" . )
rm -rf "${EXT_DIR}"
mkdir -p "${EXT_DIR}"
( cd "${ROOT_DIR}/apps/gnome-extension/[email protected]" && zip -q -r "${EXT_ZIP}" . )
if command -v gnome-extensions >/dev/null; then
if ! gnome-extensions install --force "${EXT_ZIP}"; then
echo "GNOME extension registration failed; installing the files directly." >&2
@@ -45,10 +88,15 @@ sed "s#__JARVIS_BARE__#${BARE_BIN}#" "${ROOT_DIR}/packaging/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
if [[ "${1:-}" == "--enable" ]]; then
restart_user_service() {
systemctl --user daemon-reload
systemctl --user enable jarvisd.service
if [[ "${1:-}" == "enable" ]]; then
systemctl --user enable jarvisd.service
fi
systemctl --user restart jarvisd.service
}
if [[ "${1:-}" == "--enable" ]]; then
restart_user_service enable
if command -v gnome-extensions >/dev/null && gnome-extensions enable [email protected] >/dev/null 2>&1; then
echo "GNOME extension enabled."
elif command -v gsettings >/dev/null && gsettings writable org.gnome.shell enabled-extensions >/dev/null 2>&1; then
@@ -67,6 +115,9 @@ if [[ "${1:-}" == "--enable" ]]; then
else
echo "GNOME Shell has not rescanned extensions; log out and back in, then run: gnome-extensions enable [email protected]"
fi
elif [[ "${PREVIOUSLY_ACTIVE}" == true ]]; then
restart_user_service
echo "Restarted jarvisd.service with the upgraded files."
fi
echo "Installed JARVIS-QVAC to ${APP_DIR}"
echo "Run: ${APP_DIR}/packaging/first-run.sh"