Skip to content

Commit

Permalink
Debian pkg: check if systemctl exists (fix #66)
Browse files Browse the repository at this point in the history
  • Loading branch information
JEnoch committed Jan 26, 2024
1 parent ca44eb4 commit 658c063
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion zenoh-bridge-ros2dds/.deb/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ set -e

case "$1" in
configure)
id -u zenoh-bridge-ros2dds >/dev/null 2>&1 || sudo useradd -r -s /bin/false zenoh-bridge-ros2dds
if ! command -v systemctl &> /dev/null
then
echo "WARNING: 'systemctl' not found - cannot install zenoh-bridge-ros2dds as a service."
exit 0
fi
id -u zenoh-bridge-ros2dds &> /dev/null || useradd -r -s /bin/false zenoh-bridge-ros2dds
systemctl daemon-reload
systemctl disable zenoh-bridge-ros2dds
;;
Expand Down
2 changes: 1 addition & 1 deletion zenoh-bridge-ros2dds/.deb/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set -e

case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
userdel zenoh-bridge-ros2dds
userdel zenoh-bridge-ros2dds > /dev/null 2>&1 || true
rm -rf /etc/zenoh-bridge-ros2dds
;;

Expand Down

0 comments on commit 658c063

Please sign in to comment.