#!/bin/sh
# After removing the .deb (postrm remove / purge) or the .rpm (%postun 0): systemd and udev
# forget the removed units and rules. /etc/verityrf (the configuration), /var/lib/verityrf and
# /var/log/verityrf stay; a purge of the .deb removes them. The verityrf account stays.
set -e
case "$1" in
  remove | purge | 0) ;;
  *) exit 0 ;;
esac
if [ -d /run/systemd/system ]; then
  systemctl daemon-reload || true
fi
if [ -d /run/udev ] && command -v udevadm >/dev/null 2>&1; then
  udevadm control --reload-rules || true
fi
if [ "$1" = purge ]; then
  rm -rf /etc/verityrf /var/lib/verityrf /var/log/verityrf
fi
exit 0
