From 75eafcd63052738bc1aa8dac24e1a1d4b8a50820 Mon Sep 17 00:00:00 2001 From: William Yang Date: Fri, 3 Dec 2021 17:58:21 +0100 Subject: [PATCH] build(deb): deb pkg enable/disable emqx system --- deploy/packages/deb/debian/postinst | 6 ++++++ deploy/packages/deb/debian/postrm | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/deploy/packages/deb/debian/postinst b/deploy/packages/deb/debian/postinst index 1a8dd3be8..69936cbe0 100755 --- a/deploy/packages/deb/debian/postinst +++ b/deploy/packages/deb/debian/postinst @@ -35,6 +35,12 @@ chmod -R 0755 /usr/lib/emqx/bin ln -s /usr/lib/emqx/bin/emqx /usr/bin/emqx ln -s /usr/lib/emqx/bin/emqx_ctl /usr/bin/emqx_ctl +if systemctl status --no-pager; then + systemctl enable emqx; +else + echo "systemd is not in use, skip enable emqx" +fi + case "$1" in configure) ;; diff --git a/deploy/packages/deb/debian/postrm b/deploy/packages/deb/debian/postrm index caea4a520..affb2f4cc 100755 --- a/deploy/packages/deb/debian/postrm +++ b/deploy/packages/deb/debian/postrm @@ -55,6 +55,11 @@ case "$1" in if [ -d /usr/lib/emqx ]; then rm -r /usr/lib/emqx fi + + if pidof systemd; then + systemctl disable emqx; + rm -f /etc/systemd/emqx.service + fi ;; remove)