From 3b3680c2d20f3e8d9df9d9e067148bff826b9d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Sat, 9 Apr 2016 17:02:48 +0200 Subject: [PATCH] [deb] Rely on dh_installinit to restart yunohost-firewall after upgrade --- debian/postinst | 31 ++++++++----------------------- debian/postrm | 1 - debian/prerm | 1 - debian/rules | 12 +++++++----- 4 files changed, 15 insertions(+), 30 deletions(-) diff --git a/debian/postinst b/debian/postinst index 513d9bf3..85aed721 100644 --- a/debian/postinst +++ b/debian/postinst @@ -28,23 +28,18 @@ do_configure() { restart_yunohost_firewall() { echo "Restarting YunoHost firewall..." - if [ -x /etc/init.d/yunohost-firewall ]; then - update-rc.d yunohost-firewall defaults >/dev/null || true - if [ -d /run/systemd/system ]; then - systemctl --system daemon-reload >/dev/null || true - else - invoke-rc.d yunohost-firewall start >/dev/null || true - fi - fi - deb-systemd-helper unmask yunohost-firewall.service >/dev/null || true if deb-systemd-helper --quiet was-enabled yunohost-firewall.service; then deb-systemd-helper enable yunohost-firewall.service >/dev/null || true + else + deb-systemd-helper update-state yunohost-firewall.service >/dev/null || true fi - deb-systemd-helper update-state yunohost-firewall.service >/dev/null || true - if [ -d /run/systemd/system ]; then - systemctl --system daemon-reload >/dev/null || true - deb-systemd-invoke try-restart yunohost-firewall.service >/dev/null || true + + if [ -x /etc/init.d/yunohost-firewall ]; then + update-rc.d yunohost-firewall defaults >/dev/null + if [ -n "$2" ]; then + invoke-rc.d yunohost-firewall restart >/dev/null || exit $? + fi fi } @@ -71,16 +66,6 @@ case "$1" in ;; esac -# Enable and start yunohost-api sysv service -if [ -x /etc/init.d/yunohost-api ]; then - update-rc.d yunohost-api defaults >/dev/null - if [ -d /run/systemd/system ]; then - systemctl --system daemon-reload >/dev/null || true - else - invoke-rc.d yunohost-api start || exit $? - fi -fi - #DEBHELPER# exit 0 diff --git a/debian/postrm b/debian/postrm index 2a711b13..2bbdd496 100644 --- a/debian/postrm +++ b/debian/postrm @@ -3,7 +3,6 @@ set -e if [ "$1" = "purge" ]; then - update-rc.d yunohost-api remove >/dev/null update-rc.d yunohost-firewall remove >/dev/null fi diff --git a/debian/prerm b/debian/prerm index 85f17dde..35486ea2 100644 --- a/debian/prerm +++ b/debian/prerm @@ -3,7 +3,6 @@ set -e 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 diff --git a/debian/rules b/debian/rules index 8d280ff7..ce03d0e3 100755 --- a/debian/rules +++ b/debian/rules @@ -8,12 +8,14 @@ dh ${@} --with=python2,systemd override_dh_installinit: - dh_installinit -pyunohost --name=yunohost-api --noscripts + dh_installinit -pyunohost --name=yunohost-api --restart-after-upgrade dh_installinit -pyunohost --name=yunohost-firewall --noscripts override_dh_systemd_enable: - dh_systemd_enable --name=yunohost-api - dh_systemd_enable --name=yunohost-firewall --no-enable + dh_systemd_enable --name=yunohost-api \ + yunohost-api.service + dh_systemd_enable --name=yunohost-firewall --no-enable \ + yunohost-firewall.service -override_dh_systemd_start: - dh_systemd_start --restart-after-upgrade yunohost-api.service +#override_dh_systemd_start: +# dh_systemd_start --restart-after-upgrade yunohost-api.service