mirror of https://github.com/hashicorp/consul
Browse Source
Fixes several issues with the pre/postremove scripts for both rpm and deb packages. Specifically: For postremove: - the postremove script now functions correctly (i.e. restarts consul after a package upgrade) on rpm-based systems (where $1 is numeric rather than `purge` or `upgrade`) - `systemctl daemon-reload` is called on package removal (rather than only on upgrade) - calls `systemctl try-restart` instead of `systemctl restart`, which will only (re)start consul if it was already running when the upgrade happened. For preremove: - if the package is being completely uninstalled (rather than upgraded), stop consul before removing the packagepull/12250/head
JG
3 years ago
committed by
GitHub
3 changed files with 26 additions and 9 deletions
@ -1,14 +1,19 @@
|
||||
#!/bin/bash |
||||
|
||||
if [ "$1" = "purge" ] |
||||
then |
||||
userdel consul |
||||
if [ -d "/run/systemd/system" ]; then |
||||
systemctl --system daemon-reload >/dev/null || : |
||||
fi |
||||
|
||||
if [ "$1" == "upgrade" ] && [ -d /run/systemd/system ]; then |
||||
systemctl --system daemon-reload >/dev/null || true |
||||
systemctl restart consul >/dev/null || true |
||||
fi |
||||
case "$1" in |
||||
purge | 0) |
||||
userdel consul |
||||
;; |
||||
|
||||
exit 0 |
||||
upgrade | [1-9]*) |
||||
if [ -d "/run/systemd/system" ]; then |
||||
systemctl try-restart consul.service >/dev/null || : |
||||
fi |
||||
;; |
||||
esac |
||||
|
||||
exit 0 |
||||
|
Loading…
Reference in new issue