#!/bin/sh
# Jarl: runs before the package's files are removed (also on upgrades).
set -e

# On removal (not on upgrade) stop jarld and the backup timer and remove
# jarld's boot-time link (postrm deals with the timer's). named keeps
# running with the configuration Jarl last wrote.
if [ "$1" = remove ] && [ -d /run/systemd/system ]; then
	systemctl stop jarl.service jarl-backup.timer jarl-backup.service 2>/dev/null || true
	systemctl disable jarl.service 2>/dev/null || true
	if ! command -v deb-systemd-helper >/dev/null 2>&1; then
		systemctl disable jarl-backup.timer 2>/dev/null || true
	fi
fi

exit 0
