3 # $FreeBSD: src/etc/rc.d/cleanvar,v 1.5 2003/07/14 13:02:36 mtm Exp $
7 # REQUIRE: mountcritlocal
13 # use recursion and shell test, because /usr/bin/find is not yet mounted
25 cd "$dir" && for file in .
* *
27 [ .
"$file" = ..
-o .
"$file" = ...
] && continue
28 if [ -d "$file" -a ! -L "$file" ]
40 # These files must be removed only the first time this script is run
43 [ "$1" != "reload" ] && rm -f /var
/run
/clean_var
/var
/spool
/lock
/clean_var
45 # purge /var/run /var/spool/lock and /var/spool/uucp/.Temp/*
47 if [ -d /var
/run
-a ! -f /var
/run
/clean_var
]; then
49 # And an initial utmpx file
50 (cd /var
/run
&& cp /dev
/null utmpx
&& chmod 644 utmpx
;)
53 if [ -d /var
/spool
/lock
-a ! -f /var
/spool
/lock
/clean_var
]; then
54 purgedir
/var
/spool
/lock
55 >/var
/spool
/lock
/clean_var
57 rm -rf /var
/spool
/uucp
/.Temp
/*