[arch-projects] [PATCH 19/19] rc.sysinit: Make Removing Leftover Files more smart

Kurt J. Bosch kjb-temp-2009 at alpenjodel.de
Thu Jul 7 04:04:20 EDT 2011


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 3c3039a..85fdd3b 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -232,8 +232,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/*
-	[[ ! -L /var/run && -d /var/run ]] && find /var/run/ \! -type d -delete
+	[[ -d /var/lock && $(stat -f -c %T -L /var/lock) != tmpfs ]] && rm -rf /var/lock/*
+	[[ -d /var/run && $(stat -f -c %T -L /var/run) != tmpfs ]] && find /var/run/ \! -type d -delete
 	ln -s /run/daemons /var/run/daemons
 	install -Tm 0664 -o root -g utmp <(:) /var/run/utmp
 	# Keep {x,k,g}dm happy with xorg
-- 
1.7.1



More information about the arch-projects mailing list