1 |
#!/bin/bash |
#!/bin/sh |
2 |
|
# $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 |
10 |
#%before: |
#%before: |
11 |
#%after: |
#%after: |
12 |
|
|
13 |
source /etc/sysconfig/rc |
source /etc/conf.d/rc |
14 |
source $rc_functions |
source ${rc_functions} |
15 |
|
|
16 |
echo -e ${COLOREDSTAR}"Removing /var/run/* and /var/lock/* ..." |
case "$1" in |
17 |
for i in /var/run/* |
start) |
18 |
do |
for dir in /tmp /run /var/lock |
19 |
if [ -d ${i} ] |
do |
20 |
then |
[ -d ${dir} ] || continue |
21 |
rm -rf ${i}/* |
rc_print "Removing tmp files in ${dir}/ ..." |
22 |
else |
for file in $(find ${dir} -type f) |
23 |
rm -f ${i} |
do |
24 |
fi |
[[ $(basename ${file}) = .keep ]] && continue |
25 |
done |
rm -f ${file} |
26 |
|
done |
27 |
for i in /var/lock/* |
for subdir in $(find ${dir} -mindepth 1 -type d) |
28 |
do |
do |
29 |
if [ -d ${i} ] |
[[ -f ${subdir}/.keep ]] && continue |
30 |
then |
rm -r ${subdir} |
31 |
rm -rf ${i}/* |
done |
32 |
else |
evaluate_retval |
33 |
rm -f ${i} |
done |
34 |
fi |
|
35 |
done |
rc_print "Creating new /run/utmp ..." |
36 |
evaluate_retval |
touch /run/utmp && chmod 644 /run/utmp |
37 |
|
evaluate_retval |
38 |
echo -e ${COLOREDSTAR}"Creating new /var/run/utmp ..." |
|
39 |
touch /var/run/utmp && chmod 644 /var/run/utmp |
rc_print "Creating new /var/log/wtmp ..." |
40 |
evaluate_retval |
touch /var/log/wtmp && chmod 644 /var/log/wtmp |
41 |
|
evaluate_retval |
42 |
echo -e ${COLOREDSTAR}"Removing possible /etc/nologin /fastboot and /forcefsck ..." |
|
43 |
rm -f /etc/nologin /fastboot /forcefsck |
rc_print "Removing possible /etc/nologin /fastboot and /forcefsck ..." |
44 |
evaluate_retval |
rm -f /etc/nologin /fastboot /forcefsck |
45 |
|
evaluate_retval |
46 |
update_svcstatus $1 |
|
47 |
splash svc_started "$(basename $0)" 0 |
update_svcstatus $1 |
48 |
|
splash svc_started "$(basename $0)" 0 |
49 |
|
;; |
50 |
|
|
51 |
|
*) |
52 |
|
rc_echo "Usage: $0 {start}" |
53 |
|
exit 1 |
54 |
|
;; |
55 |
|
esac |