triggers/openrc-service: add third argument to register or not services.

--HG--
extra : convert_revision : 29be73bbbfedd384a7f6d10276aac3399cc524e7
This commit is contained in:
Juan RP 2010-04-16 20:09:14 +02:00
parent 6503b908cf
commit 4037450621

View file

@ -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
;;
*)