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 # populated from the build script
24 # dash only supports one array, $@
25 if [ "%FPM_BINARIES" != "" ]; then
29 if [ "$pkg" != "" ]; then
30 # Remove the binary python files so the package manager doesn't throw warnings
31 # on removing the package.
32 find /usr/share/%PYTHON/dist/$pkg -iname *.pyc -exec rm {} \; || true
33 find /usr/share/%PYTHON/dist/$pkg -iname *.pyo -exec rm {} \; || true
35 if [ "%FPM_BINARIES" != "" ]; then
38 if [ -L /usr/bin/$binary ]; then
39 # Remove the symlinks we installed
40 rm -f /usr/bin/$binary
45 if [ "${pkg#python-}" = "arvados-cwl-runner" ]; then
46 if [ -L /usr/bin/cwl-runner ]; then
47 rm -f /usr/bin/cwl-runner