Ticket #206: bootmisc-skip-wiping-tmpfs-dirs.patch

File bootmisc-skip-wiping-tmpfs-dirs.patch, 1.9 KB (added by www.google.com/accounts/o8/id?id=aitoawkwxks0yu8ds1jw9yteckfs0bxwogv8lze, 9 months ago)
  • init.d/bootmisc.in

     
    1616        mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$ 
    1717} 
    1818 
     19is_dir_tmpfs() 
     20{ 
     21        [ -e "$1" ] && [ $(stat -fc%T "$1") = tmpfs ] 
     22} 
     23 
    1924: ${wipe_tmp:=${WIPE_TMP:-yes}} 
    2025 
    2126cleanup_tmp_dir() 
     
    98103                [ -e /var/log/wtmp ] || mkutmp /var/log/wtmp 
    99104                eend 0 
    100105 
    101                 ebegin "Cleaning /var/run" 
    102                 for x in $(find /var/run ! -type d ! -name utmp \ 
    103                         ! -name random-seed ! -name dev.db \ 
    104                         ! -name ld-elf.so.hints ! -name ld.so.hints); 
    105                 do 
    106                         # Clean stale sockets 
    107                         if [ -S "$x" ]; then 
    108                                 if type fuser >/dev/null 2>&1; then 
    109                                         fuser "$x" >/dev/null 2>&1 || rm -- "$x" 
    110                                 else 
    111                                         rm -- "$x" 
     106                if ! is_dir_tmpfs /var/run; then 
     107                        ebegin "Cleaning /var/run" 
     108                        for x in $(find /var/run ! -type d ! -name utmp \ 
     109                                ! -name random-seed ! -name dev.db \ 
     110                                ! -name ld-elf.so.hints ! -name ld.so.hints); 
     111                        do 
     112                                # Clean stale sockets 
     113                                if [ -S "$x" ]; then 
     114                                        if type fuser >/dev/null 2>&1; then 
     115                                                fuser "$x" >/dev/null 2>&1 || rm -- "$x" 
     116                                        else 
     117                                                rm -- "$x" 
     118                                        fi 
    112119                                fi 
    113                         fi 
    114                         [ ! -f "$x" ] && continue 
    115                         # Do not remove pidfiles of already running daemons 
    116                         case "$x" in 
    117                                 *.pid) 
    118                                         start-stop-daemon --test --quiet \ 
    119                                         --stop --pidfile "$x" && continue 
    120                                 ;; 
    121                         esac 
    122                         rm -f -- "$x" 
    123                 done 
    124                 eend 0 
     120                                [ ! -f "$x" ] && continue 
     121                                # Do not remove pidfiles of already running daemons 
     122                                case "$x" in 
     123                                        *.pid) 
     124                                                start-stop-daemon --test --quiet \ 
     125                                                --stop --pidfile "$x" && continue 
     126                                        ;; 
     127                                esac 
     128                                rm -f -- "$x" 
     129                        done 
     130                        eend 0 
     131                fi 
    125132        fi 
    126133 
    127134        # Clean up /tmp directories 
    128135        local tmp= 
    129136        for tmp in ${clean_tmp_dirs:-${wipe_tmp_dirs-/tmp}}; do 
    130                 cleanup_tmp_dir "$tmp" 
     137                ! is_dir_tmpfs "$tmp" && cleanup_tmp_dir "$tmp" 
    131138        done 
    132139 
    133140        if dir_writeable /tmp; then