#!/bin/sh

set -e


pre_rm() {
	local _app="yandex-solomon-agent"

	if [ -x /bin/systemctl -a -f /etc/systemd/system/${_app}.service ] ; then
		if ! /bin/systemctl stop ${_app} ; then
			echo "Cannot stop ${_app} service!"
		fi
		if ! /bin/systemctl disable ${_app} ; then
			echo "Cannot disable ${_app} service!"
		fi
	fi
}


case "$1" in
	remove|purge)
		pre_rm
	;;

	failed-upgrade|upgrade|deconfigure)
	;;

	*)
		echo "prerm called with unknown argument '$1'" >&2
		exit 1
	;;
esac
