#!/bin/sh

set -e

if [ "$1" = remove ]; then
	rm -f /var/lib/apport/autoreport
fi

# Transition the units to apport package itself
if [ -x "/usr/bin/deb-systemd-helper" ]; then
       deb-systemd-invoke stop 'apport-noui.path' 'apport-noui.service' >/dev/null || true
       deb-systemd-helper purge 'apport-noui.path' >/dev/null || true
       deb-systemd-helper unmask 'apport-noui.path' >/dev/null || true
       if dpkg --compare-versions "$2" ge 2.20.10-0ubuntu4; then
                deb-systemd-invoke stop 'apport-autoreport.path' >/dev/null || true
       fi
fi

#DEBHELPER#
