#!/bin/sh # RPM %postun — post-uninstall scriptlet (spec §7). set -eu # Detect init system if [ -d /run/systemd/system ] || [ "$(cat /proc/1/comm 2>/dev/null)" = "systemd" ]; then INIT_SYSTEM="systemd" else INIT_SYSTEM="runit" fi if [ "$1" -eq 0 ]; then # Package fully erased — remove config, store, group rm -rf /etc/fenris rm -rf /var/lib/fenris if getent group fenris > /dev/null 2>&1; then groupdel fenris 2>/dev/null || true fi fi if [ "${INIT_SYSTEM}" = "systemd" ]; then systemctl daemon-reload 2>/dev/null || true else # runit: clean up service directory and log rm -rf /etc/sv/fenris-collect 2>/dev/null || true rm -rf /var/log/fenris-collect 2>/dev/null || true fi