#!/bin/sh # Installs the usher systemd user service for crash recovery. # This is optional — in normal operation, LibreWolf manages usher's # lifecycle via Native Messaging. This service ensures usher is # available for pre-LibreWolf power monitoring and restarts on crash. # # POSIX sh. No sudo required (user-level systemd unit). set -eu SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) PROJECT_ROOT=$(cd "${SCRIPT_DIR}/.." && pwd) SERVICE_SRC="${PROJECT_ROOT}/scripts/vestibule-usher.service" SERVICE_DST="${HOME}/.config/systemd/user/vestibule-usher.service" if [ ! -x "${HOME}/.local/bin/usher" ]; then echo "error: usher not installed at ~/.local/bin/usher" >&2 echo " run install-native-host.sh first" >&2 exit 1 fi mkdir -p "$(dirname "${SERVICE_DST}")" # Substitute %h with the actual home directory (systemd user units # support %h natively, but some older versions don't — do it explicitly) sed "s|%h|${HOME}|g" "${SERVICE_SRC}" > "${SERVICE_DST}" echo "installed: ${SERVICE_DST}" systemctl --user daemon-reload systemctl --user enable vestibule-usher.service echo "enabled: vestibule-usher.service" echo echo "To start now: systemctl --user start vestibule-usher.service" echo "To check: systemctl --user status vestibule-usher.service" echo "To view logs: journalctl --user -u vestibule-usher.service -f"