diff options
Diffstat (limited to 'sbin/rc')
-rwxr-xr-x | sbin/rc | 55 |
1 files changed, 23 insertions, 32 deletions
@@ -123,8 +123,16 @@ else # As we're in the bootlevel, add any services that failed due # to /dev/.rcsysinit existing to the list if [[ -d /dev/.rcboot ]] ; then + COLDPLUG_SERVICES= for x in $(dolisting /dev/.rcboot/) ; do - [[ -L ${x} ]] && myscripts="${myscripts} ${x##*/}" + [[ -L ${x} ]] && COLDPLUG_SERVICES="${COLDPLUG_SERVICES} ${x##*/}" + done + for x in ${COLDPLUG_SERVICES} ; do + if [[ ! -e /etc/runlevels/"${BOOTLEVEL}"/"${x}" \ + && ! -e /etc/runlevels/"${DEFAULTLEVEL}"/"${x}" ]] ; then + myscripts="${myscripts} ${x}" + mark_service_coldplugged "${x}" + fi done einfo "Device initiated services:${HILITE}${myscripts}${NORMAL}" rm -rf /dev/.rcboot @@ -171,23 +179,15 @@ dep_stop() { service_stopped "${myservice}" && return 0 - # Candidate for zapping ? - [[ ! -L "${svcdir}/softscripts.new/${myservice}" ]] || \ - return 0 - - # If this is a 'net' service, we do not want to stop it if it was - # not in the previous runlevel, and we are not shutting down, - # rebooting or going to single runlevel. This is because the user - # (or hotplut) might have started it (net.ppp?) ... - if net_service "${myservice}" && \ - [[ ${SOFTLEVEL} != "reboot" && \ - ${SOFTLEVEL} != "shutdown" ]] ; then - if [[ -z ${OLDSOFTLEVEL} ]] || \ - ! in_runlevel "${myservice}" "${OLDSOFTLEVEL}" ; then - # This service is not in the previous runlevel, so - # do not stop it ... - return 0 - fi + [[ -L ${svcdir}/softscripts.new/${service} ]] \ + && return 0 + + if [[ ${SOFTLEVEL} != "reboot" \ + && ${SOFTLEVEL} != "shutdown" ]] ; then + service_coldplugged "${service}" && return 0 + [[ -z ${OLDSOFTLEVEL} ]] \ + || ! in_runlevel "${service}" "${OLDSOFTLEVEL}" \ + && return 0 fi # Should not work for 'use' @@ -254,24 +254,15 @@ fi echo "${SOFTLEVEL}" > "${svcdir}/softlevel" if [[ ${SOFTLEVEL} == "reboot" || ${SOFTLEVEL} == "shutdown" ]] ; then - source /sbin/functions.sh - # Clear $svcdir from stale entries, but leave the caches around, as it # should help speed things up a bit rm -rf $(ls -d1 "${svcdir}/"* 2>/dev/null | \ grep -ve '\(depcache\|deptree\|envcache\)') - - # Need try(), etc - source "${svclib}"/sh/init-functions.sh - source /etc/init.d/halt.sh - - if [[ ${SOFTLEVEL} == "reboot" ]] ; then - source /etc/init.d/reboot.sh - else - source /etc/init.d/shutdown.sh - fi - + # Call halt.sh with LC_ALL=C so that bash doesn't load any locales + # which could interfere with unmounting /usr + LC_ALL=C exec /etc/init.d/halt.sh "${SOFTLEVEL}" + # Should never get here exit 0 fi @@ -292,7 +283,7 @@ get_start_services() { -L "${svcdir}/softscripts/${LOGGER_SERVICE}" ]] && \ list="${list} ${LOGGER_SERVICE}" - for x in $(dolisting "${svcdir}/softscripts/") ; do + for x in $(dolisting "${svcdir}/softscripts/") ; do list="${list} ${x##*/}" done |