Catch up with renaming of macros IRQn -> ICU_IRQn in i386/icu/icu.h,1.7
[dragonfly.git] / etc / rc.d / cleanvar
blobc9dbc6cb3235fb6dc7425c96e5d66864b8a4fbcf
1 #!/bin/sh
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.4 2005/06/22 19:55:30 dillon Exp $
7 # PROVIDE: cleanvar
8 # REQUIRE: mountcritlocal
9 # KEYWORD: DragonFly
11 . /etc/rc.subr
13 dummy_rc_command "$1"
15 # use recursion and shell test, because /usr/bin/find is not yet mounted
17 purgedir()
19 local dir file
21 if [ $# -eq 0 ]; then
22 purgedir .
23 else
24 for dir
27 cd "$dir" && for file in .* *
29 [ ."$file" = .. -o ."$file" = ... ] && continue
30 if [ -d "$file" -a ! -L "$file" ]
31 then
32 purgedir "$file"
33 else
34 rm -f -- "$file"
36 done
38 done
42 # These files must be removed only the first time this script is run
43 # on boot.
45 [ "$1" != "reload" ] && rm -f /var/run/clean_var /var/spool/lock/clean_var
47 # purge /var/run /var/spool/lock and /var/spool/uucp/.Temp/*
49 if [ -d /var/run -a ! -f /var/run/clean_var ]; then
50 purgedir /var/run
51 # And an initial utmp file
52 (cd /var/run && cp /dev/null utmp && chmod 644 utmp;)
53 >/var/run/clean_var
55 if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then
56 purgedir /var/spool/lock
57 >/var/spool/lock/clean_var
59 rm -rf /var/spool/uucp/.Temp/*