#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Provenance-includes-location: https://github.com/cortexproject/cortex/blob/master/packaging/rpm/control/preun
# Provenance-includes-license: Apache-2.0
# Provenance-includes-copyright: The Cortex Authors.

set -e

# shellcheck disable=1091
[ -f /etc/sysconfig/mimir ] && . /etc/sysconfig/mimir

# Final uninstallation $1=0
# If other copies of this RPM are installed, then $1>0
if [ "$1" -eq 0 ]; then
  if command -v systemctl 2>/dev/null; then
    systemctl stop mimir.service >/dev/null 2>&1 || :
  fi
fi
