diff --git a/debian/postinst b/debian/postinst index f3374527e..4113f7661 100644 --- a/debian/postinst +++ b/debian/postinst @@ -15,10 +15,16 @@ do_configure() { yunohost service regenconf # restart yunohost-firewall if it's running - service yunohost-firewall status > /dev/null \ - && service yunohost-firewall restart \ - || echo "Service yunohost-firewall is not running, you should " \ - "consider to start it by doing 'service yunohost-firewall start'." + if service yunohost-firewall status >/dev/null; then + update-rc.d yunohost-firewall defaults >/dev/null + [ -d /run/systemd/system ] \ + && systemctl --system daemon-reload >/dev/null || true + echo "Restarting yunohost-firewall..." + invoke-rc.d yunohost-firewall restart || true + else + echo "Service yunohost-firewall is not running, you should " \ + "consider to start it by doing 'service yunohost-firewall start'." + fi fi # update PAM configs @@ -48,10 +54,14 @@ case "$1" in ;; esac -# Enable and start yunohost-api service for non-systemd system -if [ -x /etc/init.d/yunohost-api ] && [ ! -d /run/systemd/system ]; then +# Enable and start yunohost-api sysv service +if [ -x /etc/init.d/yunohost-api ]; then update-rc.d yunohost-api defaults >/dev/null - invoke-rc.d yunohost-api start || exit $? + if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + else + invoke-rc.d yunohost-api start || exit $? + fi fi #DEBHELPER# diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 000000000..2a711b136 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e + +if [ "$1" = "purge" ]; then + update-rc.d yunohost-api remove >/dev/null + update-rc.d yunohost-firewall remove >/dev/null +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/prerm b/debian/prerm index 01aee685b..85f17dde6 100644 --- a/debian/prerm +++ b/debian/prerm @@ -2,8 +2,9 @@ set -e -if [ -x "/etc/init.d/yunohost-firewall" ]; then - invoke-rc.d yunohost-firewall stop || exit $? +if [ -x /etc/init.d/yunohost-api ] && ! [ -d /run/systemd/system ]; then + invoke-rc.d yunohost-api stop || exit $? + invoke-rc.d yunohost-firewall stop || true fi #DEBHELPER# diff --git a/debian/yunohost-api.init b/debian/yunohost-api.init old mode 100755 new mode 100644 diff --git a/debian/yunohost-firewall.init b/debian/yunohost-firewall.init old mode 100755 new mode 100644