diff --git a/srcpkgs/xbps-triggers/files/openrc-service b/srcpkgs/xbps-triggers/files/openrc-service index e7aabe007c..99132f937f 100755 --- a/srcpkgs/xbps-triggers/files/openrc-service +++ b/srcpkgs/xbps-triggers/files/openrc-service @@ -45,7 +45,6 @@ run) set -- ${openrc_services} while [ $# -gt 0 ]; do unset skip_service - srv_restart=$metadatadir/.$1_srv_restart if [ "$TARGET" = "post-install" ]; then # The service shouldn't be registered, so just show a message # explaining how to add it in the future. @@ -59,10 +58,10 @@ run) esac if [ -n "$skip_service" ]; then cat <<_EOF -================================================================ +========================================================================= -The system service '${1}' won't be added into the runlevel -'${2}' by default, so it will remain disabled at boot. +The system service '${1}' from ${PKGNAME}-${VERSION} won't be added +into the runlevel '${2}' by default, so it will remain disabled at boot. To start it at boot time, use the following command: @@ -72,40 +71,40 @@ To disable it again use: $ rc-update del ${1} ${2} -================================================================ +========================================================================= _EOF shift; shift; shift; continue - else - echo "Registering '${1}' service to start at boot." fi - if [ -f $srv_restart ]; then - # Restart service if it was running previously. - $initdir/$1 start - rm -f $srv_restart - else - # Register service. - if sbin/rc-service -e ${1}; then - sbin/rc-update add ${1} ${2} - fi + # Register service. + sbin/rc-service -e ${1} + if [ $? -ne 0 ]; then + sbin/rc-update add ${1} ${2} + echo "Registering '${1}' from ${PKGNAME} service to start at boot." fi else - # While removing always stop the service if running. $initdir/$1 -q status - if [ $? -eq 0 ]; then - $initdir/$1 stop - fi - # - # While upgrading a package, don't remove the service. - # - if [ "$UPDATE" = "yes" ]; then - touch -f $srv_restart + rv=$? + + if [ "$UPDATE" = "no" ]; then + # + # If the service is running inform the user that it should be + # stopped and unregistered manually. + # + 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." + else + # Unregister the service. + sbin/rc-update del ${1} ${2} + fi else - # Unregister the service. - sbin/rc-update del ${1} ${2} + if [ $rv -eq 0 ]; then + echo "Service '${1}' from ${PKGNAME} should be restarted!" + fi fi fi - unset srv_restart shift; shift; shift; done ;; diff --git a/srcpkgs/xbps-triggers/template b/srcpkgs/xbps-triggers/template index 8083bbb0bc..c17ffbf004 100644 --- a/srcpkgs/xbps-triggers/template +++ b/srcpkgs/xbps-triggers/template @@ -1,6 +1,6 @@ # Template file for 'xbps-triggers' pkgname=xbps-triggers -version=0.9 +version=0.10 build_style=custom-install short_desc="XBPS triggers" maintainer="Juan RP "