diff options
author | Christian Heim <phreak@gentoo.org> | 2006-08-13 17:00:37 +0000 |
---|---|---|
committer | Christian Heim <phreak@gentoo.org> | 2006-08-13 17:00:37 +0000 |
commit | 193bee631b8444b7667105fe410b8cb2a4112a1d (patch) | |
tree | f2ef89e0e72324eac70e9aa6786ebac35340602b /sbin/rc-services.sh | |
parent | Merging r2151 (diff) | |
download | baselayout-vserver-193bee631b8444b7667105fe410b8cb2a4112a1d.tar.gz baselayout-vserver-193bee631b8444b7667105fe410b8cb2a4112a1d.tar.bz2 baselayout-vserver-193bee631b8444b7667105fe410b8cb2a4112a1d.zip |
Merging r2184
svn path=/baselayout-vserver/branches/baselayout-1_12/; revision=410
Diffstat (limited to 'sbin/rc-services.sh')
-rwxr-xr-x | sbin/rc-services.sh | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/sbin/rc-services.sh b/sbin/rc-services.sh index 8fcd7c1..cd09965 100755 --- a/sbin/rc-services.sh +++ b/sbin/rc-services.sh @@ -407,18 +407,29 @@ start_service() { ${START_CRITICAL} == "yes" ]] ; then # if we can not start the services in parallel # then just start it and return the exit status - ( "/etc/init.d/${service}" start ) - service_started "${service}" || service_inactive "${service}" + ( + profiling name "/etc/init.d/${service} start" + "/etc/init.d/${service}" start + ) + + service_started "${service}" || service_inactive "${service}" \ + || service_scheduled "${service}" retval=$? + end_service "${service}" "${retval}" splash "svc_started" "${service}" "${retval}" + return "${retval}" else # if parallel startup is allowed, start it in background ( + profiling name "/etc/init.d/${service} start" "/etc/init.d/${service}" start - service_started "${service}" || service_inactive "${service}" + + service_started "${service}" || service_inactive "${service}" \ + || service_scheduled "${service}" retval=$? + end_service "${service}" "${retval}" splash "svc_started" "${service}" "${retval}" ) & @@ -646,6 +657,31 @@ service_stopped() { return 0 } +# char service_scheduled_by(service) +# +# Returns a list of services which will try and start 'service' when they +# are started +# +service_scheduled_by() { + [[ -z $1 ]] && return 1 + + local x= s= r= + for x in $(dolisting "${svcdir}/scheduled/*/$1") ; do + s="${x%/*}" + r="${r} ${s##*/}" + done + + echo "${r:1}" +} + +# bool service_scheduled() +# +# Returns true if 'service' is scheduled to be started by another service +# +service_scheduled() { + [[ -n $(service_scheduled_by "$@") ]] +} + # bool mark_service_failed(service) # # Mark service as failed for current runlevel. Note that @@ -740,9 +776,8 @@ dependon() { # This is the main code for valid_after and valid_iuse # No point in writing it twice! valid_i() { - local x # Just set to dummy for now (don't know if $svcdir/softlevel exists yet). - local mylevel="${BOOTLEVEL}" + local mylevel="${BOOTLEVEL}" x= valid= [[ $1 != "after" && $1 != "use" ]] && return 1 @@ -753,8 +788,10 @@ valid_i() { [[ -e "/etc/runlevels/${BOOTLEVEL}/${x}" || \ -e "/etc/runlevels/${mylevel}/${x}" || \ ${x} == "net" ]] \ - && echo "${x}" + && valid="${valid} ${x}" done + + echo "${valid:1}" return 0 } |