Skip to content

Commit

Permalink
container images typically don't have systemd, this should allow the …
Browse files Browse the repository at this point in the history
…choria package to be installed on those images.
  • Loading branch information
TomRitserveldt committed Oct 22, 2024
1 parent a14b9b4 commit 1591eb4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
18 changes: 12 additions & 6 deletions packager/templates/debian/generic/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ action="$1"
if [ "$action" = configure ]; then
old_version="$2"

if [ -z "$old_version" ]; then
systemctl enable choria-server.service
else
systemctl try-restart choria-broker.service choria-server.service
fi
fi
if command -v systemctl 2>&1 >/dev/null
then
if [ -z "$old_version" ]; then
systemctl enable choria-server.service
else
systemctl try-restart choria-broker.service choria-server.service
fi
else
echo "systemctl could not be found, skipping service start."
exit 0
fi
fi
8 changes: 7 additions & 1 deletion packager/templates/debian/generic/postrm
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/bin/sh

systemctl daemon-reload
if command -v systemctl 2>&1 >/dev/null
then
systemctl daemon-reload
else
echo "systemctl could not be found, skipping daemon reload."
exit 0
fi
14 changes: 10 additions & 4 deletions packager/templates/debian/generic/prerm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

action="$1"

if [ "$action" = remove ]; then
systemctl --no-reload disable choria-server.service choria-broker.service
systemctl stop choria-server.service choria-broker.service
fi
if command -v systemctl 2>&1 >/dev/null
then
if [ "$action" = remove ]; then
systemctl --no-reload disable choria-server.service choria-broker.service
systemctl stop choria-server.service choria-broker.service
fi
else
echo "systemctl could not be found, skipping service disable & remove."
exit 0
fi

0 comments on commit 1591eb4

Please sign in to comment.