--- init.d/bootmisc.in 2009-11-26 12:03:39.311907098 +0100 +++ init.d/bootmisc.in 2009-11-26 12:10:07.554903556 +0100 @@ -16,6 +16,11 @@ mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$ } +is_dir_tmpfs() +{ + [ -e "$1" ] && [ $(stat -fc%T "$1") = tmpfs ] +} + : ${wipe_tmp:=${WIPE_TMP:-yes}} cleanup_tmp_dir() @@ -98,36 +103,38 @@ [ -e /var/log/wtmp ] || mkutmp /var/log/wtmp 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 - # Clean stale sockets - if [ -S "$x" ]; then - if type fuser >/dev/null 2>&1; then - fuser "$x" >/dev/null 2>&1 || rm -- "$x" - else - rm -- "$x" + if ! is_dir_tmpfs /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 + # Clean stale sockets + if [ -S "$x" ]; then + if type fuser >/dev/null 2>&1; then + fuser "$x" >/dev/null 2>&1 || rm -- "$x" + else + rm -- "$x" + fi fi - fi - [ ! -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 + [ ! -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 fi # Clean up /tmp directories local tmp= for tmp in ${clean_tmp_dirs:-${wipe_tmp_dirs-/tmp}}; do - cleanup_tmp_dir "$tmp" + ! is_dir_tmpfs "$tmp" && cleanup_tmp_dir "$tmp" done if dir_writeable /tmp; then