postinst
671 Bytes
#!/bin/bash -e
FRESH_INSTALL=true
if [[ "$1" == "configure" && "$2" != "" ]]; then
FRESH_INSTALL=false
fi
if "$FRESH_INSTALL"; then
echo "Fresh installation: enabling FlashMQ systemd service."
systemctl enable flashmq.service
else
echo "This is not a fresh installation: not (re)enabling FlashMQ systemd service."
# In case the service file changes, and to prevent systemd warnings 'service file changed' on upgrade.
systemctl daemon-reload
fi
if systemctl is-enabled --quiet flashmq.service; then
echo "FlashMQ is marked as enabled, so starting it."
systemctl start flashmq.service
else
echo "FlashMQ is marked as disabled, so not starting it."
fi