#!/bin/sh

set -e

# Stop the socket on remove and upgrade so acpid is not restarted via socket
# activation
if [ -d /run/systemd/system ] && [ "$1" = remove -o "$1" = upgrade ] ; then
        deb-systemd-invoke stop acpid.socket || true
fi

# Automatically added by dh_installsystemd/13.11.9
if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
	deb-systemd-invoke stop 'acpid.path' >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.11.9
if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
	deb-systemd-invoke stop 'acpid.socket' >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installinit/13.11.9
if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -x "/etc/init.d/acpid" ] ; then
	invoke-rc.d --skip-systemd-native acpid stop || exit 1
fi
# End automatically added section
# Automatically added by dh_runit/2.15.2
# Unlike postrm, I can be sure, that runit-helper is present on
# prerm.
if [ -z "${DPKG_ROOT:-}" ] ; then
    NAME='acpid' ENABLE='yes' ONUPGRADE='restart' /lib/runit-helper/runit-helper prerm "$@"
fi
# End automatically added section

