xbps-triggers: improvements to the openrc trigger.

This commit is contained in:
Juan RP 2011-07-20 18:53:13 +02:00
parent 547018c2cd
commit b48cec94e9
2 changed files with 20 additions and 13 deletions

View file

@ -46,10 +46,7 @@ run)
set -- ${openrc_services}
while [ $# -gt 0 ]; do
unset skip_service
if [ "$TARGET" = "post-install" ]; then
# The service shouldn't be registered, so just show a message
# explaining how to add it in the future.
case "$3" in
[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff]|0)
skip_service=1
@ -59,11 +56,13 @@ run)
;;
esac
if [ -n "$skip_service" ]; then
# The service shouldn't be registered, so just show a message
# explaining how to add it in the future.
cat <<_EOF
=========================================================================
The system service '${1}' from ${PKGNAME}-${VERSION} won't be added
into the runlevel '${2}' by default, so it will remain disabled at boot.
The service '${1}' from '${PKGNAME}-${VERSION}' won't be registered
into the runlevel '${2}', therefore it will remain disabled at boot.
To start it at boot time, use the following command:
@ -73,6 +72,10 @@ To disable it again use:
$ rc-update del ${1} ${2}
To start the service:
$ rc-service start ${1}
=========================================================================
_EOF
shift; shift; shift;
@ -81,33 +84,37 @@ _EOF
# Register service.
if [ "$UPDATE" = "no" ]; then
sbin/rc-update add ${1} ${2}
echo "Registering '${1}' from ${PKGNAME} service to start at boot."
fi
else
#
# pre-remove
#
$initdir/$1 -q status
rv=$?
if [ "$UPDATE" = "no" ]; then
#
# If the service is running inform the user that it should be
# stopped and unregistered manually.
# stopped before removing the package!
#
if [ $rv -eq 0 ]; then
echo "Service ${1} from ${PKGNAME} needs to be stopped!"
echo "Please stop the service with '$initdir/$1 stop' and unregister"
echo "the service with 'rc-update del ${1} ${2}' manually."
echo "ERROR: service '${1}' from '${PKGNAME}-${VERSION}' must be stopped!"
echo "ERROR: please stop the service with 'rc-service $1 stop' and try again."
error=1
else
# Unregister the service.
sbin/rc-update del ${1} ${2}
fi
else
if [ $rv -eq 0 ]; then
echo "Service '${1}' from ${PKGNAME} should be restarted!"
echo "WARNING: service '${1}' from '${PKGNAME}-${VERSION}' must be restarted!"
echo "WARNING: you can restart it with 'rc-service $1 restart'."
fi
fi
fi
shift; shift; shift;
done
[ -n "$error" ] && exit $error
;;
*)
exit 1

View file

@ -1,11 +1,11 @@
# Template file for 'xbps-triggers'
pkgname=xbps-triggers
version=0.18
version=0.19
build_style=custom-install
short_desc="XBPS triggers"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://code.google.com/p/xbps"
license="BSD"
license="Simplified BSD"
long_desc="
This package installs the triggers used by the XBPS binary packages."