#!/usr/bin/env bash set -euo pipefail SERVICE_NAME="luxtools-client" INSTALL_DIR="${HOME}/.local/share/${SERVICE_NAME}" CONFIG_DIR="${HOME}/.config/${SERVICE_NAME}" UNIT_FILE="${HOME}/.config/systemd/user/${SERVICE_NAME}.service" usage() { cat </dev/null 2>&1 || true systemctl --user disable "$SERVICE_NAME" >/dev/null 2>&1 || true systemctl --user reset-failed "$SERVICE_NAME" >/dev/null 2>&1 || true # Also stop/disable any leftover system-wide service from older installs. if systemctl list-unit-files 2>/dev/null | grep -q "^${SERVICE_NAME}\.service"; then if [[ ${EUID} -eq 0 ]]; then systemctl stop "$SERVICE_NAME" >/dev/null 2>&1 || true systemctl disable "$SERVICE_NAME" >/dev/null 2>&1 || true systemctl reset-failed "$SERVICE_NAME" >/dev/null 2>&1 || true elif command -v sudo >/dev/null 2>&1; then sudo systemctl stop "$SERVICE_NAME" >/dev/null 2>&1 || true sudo systemctl disable "$SERVICE_NAME" >/dev/null 2>&1 || true sudo systemctl reset-failed "$SERVICE_NAME" >/dev/null 2>&1 || true else echo "Note: a system service '${SERVICE_NAME}.service' exists; run with sudo to stop it." >&2 fi fi rm -f "$UNIT_FILE" systemctl --user daemon-reload || true rm -rf "$INSTALL_DIR" if [[ $KEEP_CONFIG -eq 0 ]]; then rm -rf "$CONFIG_DIR" fi echo "Uninstalled ${SERVICE_NAME}." if [[ $KEEP_CONFIG -eq 1 ]]; then echo "Kept config directory: ${CONFIG_DIR}" fi