From 40374506215b809fae9392d993fb7669b1731b15 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 16 Apr 2010 20:09:14 +0200 Subject: [PATCH] triggers/openrc-service: add third argument to register or not services. --HG-- extra : convert_revision : 29be73bbbfedd384a7f6d10276aac3399cc524e7 --- xbps-src/triggers/openrc-service | 42 ++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/xbps-src/triggers/openrc-service b/xbps-src/triggers/openrc-service index 7267d329e2d..e7aabe007cb 100755 --- a/xbps-src/triggers/openrc-service +++ b/xbps-src/triggers/openrc-service @@ -1,7 +1,12 @@ #!/bin/sh # # Registers or unregisters OpenRC services into the specified -# runlevel. +# runlevel. This works by specifying three arguments as follows: +# +# service_name runlevel register +# -------------------------------------------------- +# dbus default boolean +# -------------------------------------------------- # # Arguments: $ACTION = [run/targets] # $TARGET = [post-install/pre-remove] @@ -39,8 +44,41 @@ 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. + case "$3" in + [Ff][Aa][Ll][Ss][Ee]|[Oo][Ff]|0) + skip_service=1 + ;; + [Tt][Rr][Uu][Ee]|[Oo][Nn]|1) + unset skip_service + ;; + 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. + +To start it at boot time, use the following command: + + $ rc-update add ${1} ${2} + +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 @@ -68,7 +106,7 @@ run) fi fi unset srv_restart - shift; shift; + shift; shift; shift; done ;; *)