diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 277a116100..5b8666bfcd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: build on: push: # Sequence of patterns matched against refs/heads - branches: [ + branches: [ "main" ] @@ -145,6 +145,7 @@ jobs: config_dir: ".release/linux/package" preinstall: ".release/linux/preinstall" postinstall: ".release/linux/postinstall" + preremove: ".release/linux/preremove" postremove: ".release/linux/postremove" - name: Set Package Names diff --git a/.release/linux/postremove b/.release/linux/postremove index f317598216..b09bdfe60e 100644 --- a/.release/linux/postremove +++ b/.release/linux/postremove @@ -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 diff --git a/.release/linux/preremove b/.release/linux/preremove new file mode 100644 index 0000000000..16fef7f3b4 --- /dev/null +++ b/.release/linux/preremove @@ -0,0 +1,11 @@ +#!/bin/bash +case "$1" in + remove | 0) + if [ -d "/run/systemd/system" ]; then + systemctl --no-reload disable consul.service > /dev/null || : + systemctl stop consul.service > /dev/null || : + fi + ;; +esac + +exit 0