| 1 |
#!/bin/sh |
| 2 |
# prerm script for barman |
| 3 |
|
| 4 |
set -e |
| 5 |
|
| 6 |
case "$1" in |
| 7 |
remove|upgrade|deconfigure) |
| 8 |
# dh_installsystemd only manages the bare template, not its per-server |
| 9 |
# instances, so stop any running instance before the barman binary and |
| 10 |
# polkit rule go away (otherwise it is left orphaned holding its |
| 11 |
# replication slot, or crash-loops under Restart=). deb-systemd-invoke |
| 12 |
# honours policy-rc.d and is a no-op when systemd is not running. |
| 13 |
if command -v deb-systemd-invoke >/dev/null; then |
| 14 |
deb-systemd-invoke stop 'barman-receive-wal@*.service' >/dev/null 2>&1 || true |
| 15 |
fi |
| 16 |
;; |
| 17 |
|
| 18 |
failed-upgrade) |
| 19 |
;; |
| 20 |
|
| 21 |
*) |
| 22 |
echo "prerm called with unknown argument \`$1'" >&2 |
| 23 |
exit 1 |
| 24 |
;; |
| 25 |
esac |
| 26 |
|
| 27 |
#DEBHELPER# |
| 28 |
|
| 29 |
exit 0 |