/[vps]/baselayout-vserver/branches/baselayout-1_12/sbin/rc
Gentoo

Diff of /baselayout-vserver/branches/baselayout-1_12/sbin/rc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 275 Revision 276
161 161
162 # Ensure all critical services have are in the boot runlevel 162 # Ensure all critical services have are in the boot runlevel
163 check_critical_services 163 check_critical_services
164 164
165 # Update the dependency cache 165 # Update the dependency cache
166 /sbin/depscan.sh -u 166 /sbin/depscan.sh
167 167
168 # Now that the dependency cache are up to date, make sure these 168 # Now that the dependency cache are up to date, make sure these
169 # are marked as started ... 169 # are marked as started ...
170 ( 170 (
171 # Needed for mark_service_started() 171 # Needed for mark_service_started()
302 reverse_list $(trace_dependencies ${list}) 302 reverse_list $(trace_dependencies ${list})
303} 303}
304 304
305dep_stop() { 305dep_stop() {
306 local x dep needsme depservice 306 local x dep needsme depservice
307 local myservice=${1##*/} 307 local service=${1##*/}
308 308
309 service_stopped "${myservice}" && return 0 309 service_stopped "${service}" && return 0
310 310
311 # Candidate for zapping ? 311 # Candidate for zapping ?
312 [[ ! -L ${svcdir}/softscripts.new/${myservice} ]] || \ 312 [[ ! -L ${svcdir}/softscripts.new/${service} ]] || \
313 return 0 313 return 0
314 314
315 # If this is a 'net' service, we do not want to stop it if it was 315 # If this is a 'net' service, we do not want to stop it if it was
316 # not in the previous runlevel, and we are not shutting down, 316 # not in the previous runlevel, and we are not shutting down,
317 # rebooting or going to single runlevel. This is because the user 317 # rebooting or going to single runlevel. This is because the user
318 # (or hotplut) might have started it (net.ppp?) ... 318 # (or hotplut) might have started it (net.ppp?) ...
319 if net_service "${myservice}" && \ 319 if net_service "${service}" && \
320 [[ ${SOFTLEVEL} != "reboot" && \ 320 [[ ${SOFTLEVEL} != "reboot" && \
321 ${SOFTLEVEL} != "shutdown" ]] ; then 321 ${SOFTLEVEL} != "shutdown" ]] ; then
322 if [[ -z ${OLDSOFTLEVEL} ]] || \ 322 if [[ -z ${OLDSOFTLEVEL} ]] || \
323 ! in_runlevel "${myservice}" "${OLDSOFTLEVEL}" 323 ! in_runlevel "${service}" "${OLDSOFTLEVEL}"
324 then 324 then
325 # This service is not in the previous runlevel, so 325 # This service is not in the previous runlevel, so
326 # do not stop it ... 326 # do not stop it ...
327 return 0 327 return 0
328 fi 328 fi
329 fi 329 fi
330 330
331 # Should not work for 'use' 331 # Should not work for 'use'
332 if [[ -z $(needsme "${myservice}") ]] ; then 332 if [[ -z $(needsme "${service}") ]] ; then
333 # Nothing depends on me 333 # Nothing depends on me
334 stop_service "${myservice}" 334 stop_service "${service}"
335 else 335 else
336 # Something may depend on me 336 # Something may depend on me
337 needsme=0 337 needsme=0
338 338
339 for dep in $(needsme "${myservice}") ; do 339 for dep in $(needsme "${service}") ; do
340 if [[ -L "${svcdir}/softscripts.new/${dep}" ]] ; then 340 if [[ -L "${svcdir}/softscripts.new/${dep}" ]] ; then
341 # This dep is valid 341 # This dep is valid
342 needsme=1 342 needsme=1
343 343
344 break 344 break
345 fi 345 fi
346 done 346 done
347 347
348 [[ ${needsme} -eq 0 ]] && stop_service "${myservice}" 348 [[ ${needsme} -eq 0 ]] && stop_service "${service}"
349 fi 349 fi
350} 350}
351 351
352# Stop services 352# Stop services
353if [[ ${SOFTLEVEL} != "reboot" && \ 353if [[ ${SOFTLEVEL} != "reboot" && \
362else 362else
363 get_critical_services 363 get_critical_services
364 364
365 is_critical_service() { 365 is_critical_service() {
366 local x 366 local x
367 local myservice=${1##*/} 367 local service=${1##*/}
368 368
369 for x in ${CRITICAL_SERVICES} ${LOGGER_SERVICE} ; do 369 for x in ${CRITICAL_SERVICES} ${LOGGER_SERVICE} ; do
370 [[ ${myservice} == "${x}" ]] && return 0 370 [[ ${service} == "${x}" ]] && return 0
371 done 371 done
372 372
373 return 1 373 return 1
374 } 374 }
375 375
393# else they will not get the depend's right (wrong SOFTLEVEL) 393# else they will not get the depend's right (wrong SOFTLEVEL)
394 394
395echo "${SOFTLEVEL}" > "${svcdir}/softlevel" 395echo "${SOFTLEVEL}" > "${svcdir}/softlevel"
396 396
397if [[ ${SOFTLEVEL} == "reboot" || ${SOFTLEVEL} == "shutdown" ]] ; then 397if [[ ${SOFTLEVEL} == "reboot" || ${SOFTLEVEL} == "shutdown" ]] ; then
398 source /sbin/functions.sh
399
400 # Clear $svcdir from stale entries, but leave the caches around, as it 398 # Clear $svcdir from stale entries, but leave the caches around, as it
401 # should help speed things up a bit 399 # should help speed things up a bit
402 rm -rf $(ls -d1 "${svcdir}/"* 2>/dev/null | \ 400 rm -rf $(ls -d1 "${svcdir}/"* 2>/dev/null | \
403 grep -ve '\(depcache\|deptree\|envcache\)') 401 grep -ve '\(depcache\|deptree\|envcache\)')
404 402

Legend:
Removed from v.275  
changed lines
  Added in v.276

  ViewVC Help
Powered by ViewVC 1.1.20