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

View file

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