#!/bin/sh
set -e

if dpkg-statoverride --list /lib/systemd-cron/crontab_setgid > /dev/null ; then
    dpkg-statoverride --remove /lib/systemd-cron/crontab_setgid
fi

if [ "$1" = "purge" ]; then 
    rm -f /var/lib/systemd/timers/stamp-cron-*.timer
    if [ -f  /etc/cron.allow ]; then
	mv /etc/cron.allow /etc/cron.deny /var/tmp
	echo "Moved files  /etc/cron.allow and /etc/cron.deny to /var/tmp"
    fi
fi

rm -f /lib/systemd/system-generators/__pycache__/systemd-crontab-generator*.pyc
rmdir /lib/systemd/system-generators/__pycache__/ 2> /dev/null || true

#DEBHELPER#
