3 # $FreeBSD: src/etc/rc.d/cleanvar,v 1.5 2003/07/14 13:02:36 mtm Exp $
4 # $DragonFly: src/etc/rc.d/cleanvar,v 1.5 2005/11/19 22:47:32 swildner Exp $
8 # REQUIRE: mountcritlocal
14 # use recursion and shell test, because /usr/bin/find is not yet mounted
26 cd "$dir" && for file in .
* *
28 [ .
"$file" = ..
-o .
"$file" = ...
] && continue
29 if [ -d "$file" -a ! -L "$file" ]
41 # These files must be removed only the first time this script is run
44 [ "$1" != "reload" ] && rm -f /var
/run
/clean_var
/var
/spool
/lock
/clean_var
46 # purge /var/run /var/spool/lock and /var/spool/uucp/.Temp/*
48 if [ -d /var
/run
-a ! -f /var
/run
/clean_var
]; then
50 # And an initial utmp file
51 (cd /var
/run
&& cp /dev
/null utmp
&& chmod 644 utmp
;)
54 if [ -d /var
/spool
/lock
-a ! -f /var
/spool
/lock
/clean_var
]; then
55 purgedir
/var
/spool
/lock
56 >/var
/spool
/lock
/clean_var
58 rm -rf /var
/spool
/uucp
/.Temp
/*