#!/bin/bash -e
# Script based on the RPM %systemd_preun scriptlet. See:
#   - https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_systemd
#   - https://cgit.freedesktop.org/systemd/systemd/tree/src/core/macros.systemd.in

if [ $1 -eq 0 ] ; then
    # Package removal, not upgrade
    systemctl --no-reload disable routinator.service > /dev/null 2>&1 || :
    systemctl stop routinator.service > /dev/null 2>&1 || :
fi