2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
8 # Detect rpm-based systems: the exit code of the following command is zero
10 if /usr/bin/rpm -q -f /usr/bin/rpm >/dev/null 2>&1; then
11 # Red Hat ("%{...}" is interpolated at package build time)
14 prefix="${RPM_INSTALL_PREFIX}"
17 script="$(basename "${0}")"
18 pkg="${script%.prerm}"
23 case "${pkgtype}-${1}" in
25 if [ -e /run/systemd/system ]; then
26 systemctl stop "${pkg}" || true
27 systemctl disable "${pkg}" || true
29 if [ -e "${prefix}/share/doc/${pkg}/${pkg}.service" ]; then
30 # Unit files from Python packages get installed by
31 # postinst so we have to remove them explicitly here.
32 rm "/lib/systemd/system/${pkg}/${pkg}.service" || true