#!/bin/bash

if [ -d /run/systemd/system ] ; then
	systemctl --system daemon-reload >/dev/null || true
fi

if [ "$1" == "remove" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper mask statusd.socket >/dev/null
	fi
fi

if [ "$1" == "purge" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper purge statusd.socket >/dev/null
		deb-systemd-helper unmask statusd.socket >/dev/null
	fi
fi

if [ "$1" == "remove" -o "$1" == "purge" ]; then
	if ! [ -d /run/systemd/system ]; then
		echo "No systemd - don't forget to remove statusd from /etc/inetd.conf"
		echo
		echo "And restart inetd: /etc/init.d/openbsd-inetd restart"
	fi
fi
