[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

20
debian/postinst vendored
View file

@ -15,11 +15,17 @@ do_configure() {
yunohost service regenconf yunohost service regenconf
# restart yunohost-firewall if it's running # restart yunohost-firewall if it's running
service yunohost-firewall status > /dev/null \ if service yunohost-firewall status >/dev/null; then
&& service yunohost-firewall restart \ update-rc.d yunohost-firewall defaults >/dev/null
|| echo "Service yunohost-firewall is not running, you should " \ [ -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'." "consider to start it by doing 'service yunohost-firewall start'."
fi fi
fi
# update PAM configs # update PAM configs
pam-auth-update --package pam-auth-update --package
@ -48,11 +54,15 @@ case "$1" in
;; ;;
esac esac
# Enable and start yunohost-api service for non-systemd system # Enable and start yunohost-api sysv service
if [ -x /etc/init.d/yunohost-api ] && [ ! -d /run/systemd/system ]; then if [ -x /etc/init.d/yunohost-api ]; then
update-rc.d yunohost-api defaults >/dev/null 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 $? invoke-rc.d yunohost-api start || exit $?
fi fi
fi
#DEBHELPER# #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 set -e
if [ -x "/etc/init.d/yunohost-firewall" ]; then if [ -x /etc/init.d/yunohost-api ] && ! [ -d /run/systemd/system ]; then
invoke-rc.d yunohost-firewall stop || exit $? invoke-rc.d yunohost-api stop || exit $?
invoke-rc.d yunohost-firewall stop || true
fi fi
#DEBHELPER# #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