#!/usr/bin/sh
set -eu

if [ -d /run/systemd/system ]; then
    if systemctl is-active --quiet mudfish-dns.service; then
        touch /run/mudfish-dns-package-restart
    fi
    systemctl stop mudfish-dns.service
fi
# Run before replacing or removing the recovery binary; propagate failures.
mudfish-dns-service --restore-dns
