8784: Fix test for latest firefox.
[arvados.git] / build / go-python-package-scripts / prerm
1 #!/bin/sh
2
3 set -e
4
5 if [ "%{name}" != "%\{name\}" ]; then
6     # Red Hat ("%{...}" is interpolated at package build time)
7     pkg="%{name}"
8     pkgtype=rpm
9     prefix="${RPM_INSTALL_PREFIX}"
10 else
11     # Debian
12     script="$(basename "${0}")"
13     pkg="${script%.prerm}"
14     pkgtype=deb
15     prefix=/usr
16 fi
17
18 case "${pkgtype}-${1}" in
19     deb-remove | rpm-0)
20         if [ -e /run/systemd/system ]; then
21             systemctl stop "${pkg}" || true
22             systemctl disable "${pkg}" || true
23         fi
24         if [ -e "${prefix}/share/doc/${pkg}/${pkg}.service" ]; then
25             # Unit files from Python packages get installed by
26             # postinst so we have to remove them explicitly here.
27             rm "/lib/systemd/system/${pkg}/${pkg}.service" || true
28         fi
29         ;;
30 esac