[fix] Attempt to improve services management in Debian packaging

This commit is contained in:
Jérôme Lebleu 2016-03-12 22:33:36 +01:00
parent 1300f4c0ca
commit 5664efad1d
5 changed files with 32 additions and 9 deletions

24
debian/postinst vendored
View file

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

12
debian/postrm vendored Normal file
View file

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

5
debian/prerm vendored
View file

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

0
debian/yunohost-api.init vendored Executable file → Normal file
View file

0
debian/yunohost-firewall.init vendored Executable file → Normal file
View file