[deb] Rely on dh_installinit to restart yunohost-firewall after upgrade

This commit is contained in:
Jérôme Lebleu 2016-04-09 17:02:48 +02:00
parent cc60c2a08d
commit 3b3680c2d2
4 changed files with 15 additions and 30 deletions

31
debian/postinst vendored
View file

@ -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

1
debian/postrm vendored
View file

@ -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

1
debian/prerm vendored
View file

@ -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

12
debian/rules vendored
View file

@ -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