--- bootmisc.orig 2008-09-24 18:21:17.000000000 -0700 +++ bootmisc 2008-09-24 18:23:20.000000000 -0700 @@ -83,31 +83,8 @@ chmod 0644 /var/run/utmp /var/log/wtmp fi eend 0 - - ebegin "Cleaning /var/run" - for x in $(find /var/run ! -type d ! -name utmp \ - ! -name random-seed ! -name dev.db \ - ! -name ld-elf.so.hints ! -name ld.so.hints); - do - [ ! -f "${x}" ] && continue - # Do not remove pidfiles of already running daemons - case "${x}" in - *.pid) - start-stop-daemon --test --quiet \ - --stop --pidfile "${x}" && continue - ;; - esac - rm -f -- "${x}" - done - eend 0 fi - # Clean up /tmp directories - local tmp= - for tmp in ${wipe_tmp_dirs-/tmp}; do - cleanup_tmp_dir "${tmp}" - done - if dir_writeable /tmp; then # Make sure our X11 stuff have the correct permissions # Omit the chown as bootmisc is run before network is up @@ -132,6 +109,31 @@ stop() { + if dir_writeable /var/run; then + ebegin "Cleaning /var/run" + for x in $(find /var/run ! -type d ! -name utmp \ + ! -name random-seed ! -name dev.db \ + ! -name ld-elf.so.hints ! -name ld.so.hints); + do + [ ! -f "${x}" ] && continue + # Do not remove pidfiles of already running daemons + case "${x}" in + *.pid) + start-stop-daemon --test --quiet \ + --stop --pidfile "${x}" && continue + ;; + esac + rm -f -- "${x}" + done + eend 0 + fi + + # Clean up /tmp directories + local tmp= + for tmp in ${wipe_tmp_dirs-/tmp}; do + cleanup_tmp_dir "${tmp}" + done + # Write a halt record if we're shutting down case "${RC_RUNLEVEL}" in reboot|shutdown) [ "${RC_UNAME}" = "Linux" ] && halt -w;;