Instead of guessing about symlinks, use stat to check whether the filesystem 
refered to is actually a tmpfs.
Then always clean up if it isn't.
---
 rc.sysinit |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index 7357582..1dd3d9a 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -228,8 +228,8 @@ RANDOM_SEED=/var/lib/misc/random-seed
 
 stat_busy "Removing Leftover Files"
        rm -rf /etc/{nologin,shutdownpid} /forcefsck /tmp/* /tmp/.* 
/var/run/daemons &>/dev/null
-       [[ ! -L /var/lock ]] && rm -rf /var/lock/*
-       if [[ ! -L /var/run && -d /var/run ]]; then
+       [[ -d /var/lock && $(stat -f -c %T -L /var/lock) != tmpfs ]] && rm -rf 
/var/lock/*
+       if [[ -d /var/run && $(stat -f -c %T -L /var/run) != tmpfs ]]; then
                find /var/run/ \! -type d -delete
                ln -s /run/daemons /var/run/daemons
        fi
-- 
1.7.1

Reply via email to