Skip to content

Commit

Permalink
Merge pull request #218 from marcosfrm/systemd-helper
Browse files Browse the repository at this point in the history
DEB: disable service on purge instead of removal, restart on upgrade
  • Loading branch information
jcoffland committed Feb 17, 2024
2 parents 2391835 + fe6fc84 commit 80b4789
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions install/debian/postinst.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ fi

systemctl daemon-reload || true

# Only enable/start on initial install
# Add/update state file, required for purge action in postrm
deb-systemd-helper update-state $NAME.service || true

# Only enable on initial install
if [ -z "$2" ]; then
systemctl -q enable $NAME || true
systemctl start $NAME || true
Expand All @@ -49,7 +52,7 @@ else
systemctl -q enable $NAME || true
fi

systemctl try-restart $NAME || true
systemctl restart $NAME || true
fi

echo
Expand Down
3 changes: 3 additions & 0 deletions install/debian/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ case "$1" in
;;

purge)
# Disable service
deb-systemd-helper purge $NAME.service || true

# Remove all files
rm -rf /etc/$NAME /var/lib/$NAME /var/log/$NAME

Expand Down
1 change: 0 additions & 1 deletion install/debian/prerm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ NAME=fah-client
case "$1" in
remove)
systemctl stop $NAME || true
systemctl -q disable $NAME || true
;;
esac

0 comments on commit 80b4789

Please sign in to comment.