Magellan Linux

Diff of /trunk/initscripts/sysvinit/rc/cleanfs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1356 by niro, Sat Jun 4 21:05:01 2011 UTC revision 1665 by niro, Fri Jan 20 23:01:04 2012 UTC
# Line 1  Line 1 
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
# Line 13  Line 13 
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 /run /var/lock
19   for file in $(find ${dir} -type f)   do
20   do   [ -d ${dir} ] || continue
21   [[ $(basename ${file}) = .keep ]] && continue   rc_print "Removing tmp files in ${dir}/ ..."
22   rm -f ${file}   for file in $(find ${dir} -type f)
23   done   do
24   for subdir in $(find ${dir} -mindepth 1 -type d)   [[ $(basename ${file}) = .keep ]] && continue
25   do   rm -f ${file}
26   [[ -f ${subdir}/.keep ]] && continue   done
27   rm -r ${subdir}   for subdir in $(find ${dir} -mindepth 1 -type d)
28   done   do
29   evaluate_retval   [[ -f ${subdir}/.keep ]] && continue
30  done   rm -r ${subdir}
31     done
32  rc_print "Creating new /var/run/utmp ..."   evaluate_retval
33  touch /var/run/utmp && chmod 644 /var/run/utmp   done
34  evaluate_retval  
35     rc_print "Creating new /run/utmp ..."
36  rc_print "Creating new /var/run/wtmp ..."   touch /run/utmp && chmod 644 /run/utmp
37  touch /var/log/wtmp && chmod 644 /var/log/wtmp   evaluate_retval
38  evaluate_retval  
39     rc_print "Creating new /var/log/wtmp ..."
40  rc_print "Removing possible /etc/nologin /fastboot and /forcefsck ..."   touch /var/log/wtmp && chmod 644 /var/log/wtmp
41  rm -f /etc/nologin /fastboot /forcefsck   evaluate_retval
42  evaluate_retval  
43     rc_print "Removing possible /etc/nologin /fastboot and /forcefsck ..."
44  update_svcstatus $1   rm -f /etc/nologin /fastboot /forcefsck
45  splash svc_started "$(basename $0)" 0   evaluate_retval
46    
47     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

Legend:
Removed from v.1356  
changed lines
  Added in v.1665