#!/bin/sh

set -e

case "$1" in
    purge)
        rm -fr /etc/zabbix/zabbix_agentd.conf.d
        rm -fr /var/log/zabbix-agent
        rm -fr /run/zabbix

        # Can be removed after Wheezy:
        ucf --purge /etc/zabbix/zabbix_agent.conf || true
    ;;
esac

# Automatically added by dh_installinit/13.3.4
if [ "$1" = "purge" ] ; then
	update-rc.d zabbix-agent remove >/dev/null
fi
# End automatically added section
# Automatically added by dh_ucf/13.3.4
if [ "$1" = "purge" ]; then
	for ext in .ucf-new .ucf-old .ucf-dist ""; do
		rm -f "/etc/zabbix/zabbix_agentd.conf$ext"
	done
	
	if [ -x "`which ucf 2>/dev/null`" ]; then
		ucf --purge "/etc/zabbix/zabbix_agentd.conf"
	fi
	if [ -x "`which ucfr 2>/dev/null`" ]; then
		ucfr --purge zabbix-agent "/etc/zabbix/zabbix_agentd.conf"
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.3.4
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
	systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.3.4
if [ "$1" = "remove" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper mask 'zabbix-agent.service' >/dev/null || true
	fi
fi

if [ "$1" = "purge" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper purge 'zabbix-agent.service' >/dev/null || true
		deb-systemd-helper unmask 'zabbix-agent.service' >/dev/null || true
	fi
fi
# End automatically added section