#!/bin/sh
# Runs after the package is removed or purged. Drop systemd's view of the
# units so they disappear from `systemctl list-unit-files`. On purge, also
# remove the generated /etc/default/nginx-logtail (we don't ship it as a
# conffile; postinst renders it from a template on first install).
set -e

case "$1" in
    purge)
        rm -f /etc/default/nginx-logtail
        if [ -d /run/systemd/system ]; then
            systemctl daemon-reload || true
        fi
        ;;
    remove)
        if [ -d /run/systemd/system ]; then
            systemctl daemon-reload || true
        fi
        ;;
esac

#DEBHELPER#
exit 0
