#!/bin/sh
# clawbox-gparted-engine postrm.  Vdisk images in /var/lib/clawbox-gparted/vdisks are left in
# place on remove and on purge: they are the user's data.
set -e

case "$1" in
	remove|purge)
		# The engine's runtime udev rule for vdisk loop nodes (written at each start).
		rm -f /run/udev/rules.d/70-clawbox-gparted-vdisks.rules
		udevadm control --reload 2> /dev/null || true
		;;
esac
case "$1" in
	purge)
		rm -f /etc/clawbox-gparted/owner
		;;
esac
if [ -d /run/systemd/system ]; then
	systemctl daemon-reload || true
fi

exit 0
