#!/bin/sh
set -eu
if [ "$(id -u)" -ne 0 ]; then echo "Run as root." >&2; exit 1; fi
if command -v systemctl >/dev/null 2>&1; then
  systemctl disable --now bayouradar-skywarn.service 2>/dev/null || true
  rm -f /etc/systemd/system/bayouradar-skywarn.service
  systemctl daemon-reload
fi
rm -f /etc/cron.d/bayouradar-skywarn
rm -rf /opt/bayouradar-skywarn /run/bayouradar-skywarn
printf '%s\n' "Configuration and history remain in /etc/bayouradar-skywarn and /var/lib/bayouradar-skywarn."
