| 123456789101112131415161718192021222324 |
- #!/usr/bin/env bash
- # Remove hthd units and binaries. Does not delete /var/lib/hth captures unless --purge.
- set -euo pipefail
- PREFIX="${PREFIX:-/usr/local}"
- BINDIR="${BINDIR:-${PREFIX}/bin}"
- LIBDIR="${LIBDIR:-/usr/lib}"
- SYSCONFDIR="${SYSCONFDIR:-/etc}"
- UNITDIR="${UNITDIR:-${SYSCONFDIR}/systemd/system}"
- ETCDIR="${ETCDIR:-${SYSCONFDIR}/hth}"
- PURGE=0
- if [[ "${1:-}" == "--purge" ]]; then
- PURGE=1
- fi
- if command -v systemctl >/dev/null 2>&1 && [[ "$(cat /proc/1/comm 2>/dev/null)" == systemd ]]; then
- systemctl disable --now hthd.service 2>/dev/null || true
- systemctl daemon-reload || true
- fi
- rm -f "${BINDIR}/hthd" "${BINDIR}/hthctl" "${BINDIR}/hth-capture"
- rm -f "${UNITDIR}/hthd.service" "${UNITDIR}/hthd@.service"
- rm -f "${LIBDIR}/sysusers.d/hth.conf" "${LIBDIR}/tmpfiles.d/hth.conf"
- if [[ "${PURGE}" -eq 1 ]]; then
- rm -rf "${ETCDIR}" /var/lib/hth /run/hth
- fi
- echo "uninstalled hthd binaries and units (purge=${PURGE})"
|