1 |
#!/bin/bash |
#!/bin/sh |
2 |
# $Id$ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/busybox-initscripts/rc/cleanfs,v 1.2 2008-06-10 22:23:30 niro Exp $ |
3 |
|
|
4 |
#%rlevels: 7:s |
#%rlevels: 7:s |
5 |
#%start: 50 |
#%start: 50 |
13 |
source /etc/conf.d/rc |
source /etc/conf.d/rc |
14 |
source ${rc_functions} |
source ${rc_functions} |
15 |
|
|
16 |
for dir in /tmp /var/run /var/lock |
case "$1" in |
17 |
do |
start) |
18 |
rc_print "Removing tmp files in ${dir}/ ..." |
for dir in /tmp /var/run /var/lock |
19 |
for file in $(find ${dir} -type f) |
do |
20 |
do |
rc_print "Removing tmp files in ${dir}/ ..." |
21 |
[[ $(basename ${file}) = .keep ]] && continue |
for file in $(find ${dir} -type f) |
22 |
rm -f ${file} |
do |
23 |
done |
[[ $(basename ${file}) = .keep ]] && continue |
24 |
for subdir in $(find ${dir} -mindepth 1 -type d) |
rm -f ${file} |
25 |
do |
done |
26 |
[[ -f ${subdir}/.keep ]] && continue |
for subdir in $(find ${dir} -mindepth 1 -type d) |
27 |
rm -r ${subdir} |
do |
28 |
done |
[[ -f ${subdir}/.keep ]] && continue |
29 |
evaluate_retval |
rm -r ${subdir} |
30 |
done |
done |
31 |
|
evaluate_retval |
32 |
rc_print "Creating new /var/run/utmp ..." |
done |
33 |
touch /var/run/utmp && chmod 644 /var/run/utmp |
|
34 |
evaluate_retval |
rc_print "Creating new /var/run/utmp ..." |
35 |
|
touch /var/run/utmp && chmod 644 /var/run/utmp |
36 |
rc_print "Creating new /var/run/wtmp ..." |
evaluate_retval |
37 |
touch /var/log/wtmp && chmod 644 /var/log/wtmp |
|
38 |
evaluate_retval |
rc_print "Creating new /var/run/wtmp ..." |
39 |
|
touch /var/log/wtmp && chmod 644 /var/log/wtmp |
40 |
rc_print "Removing possible /etc/nologin /fastboot and /forcefsck ..." |
evaluate_retval |
41 |
rm -f /etc/nologin /fastboot /forcefsck |
|
42 |
evaluate_retval |
rc_print "Removing possible /etc/nologin /fastboot and /forcefsck ..." |
43 |
|
rm -f /etc/nologin /fastboot /forcefsck |
44 |
update_svcstatus $1 |
evaluate_retval |
45 |
splash svc_started "$(basename $0)" 0 |
|
46 |
|
update_svcstatus $1 |
47 |
|
splash svc_started "$(basename $0)" 0 |
48 |
|
;; |
49 |
|
|
50 |
|
*) |
51 |
|
rc_echo "Usage: $0 {start}" |
52 |
|
exit 1 |
53 |
|
;; |
54 |
|
esac |