--- trunk/initscripts/sysvinit/rc/cleanfs 2011/06/04 21:32:26 1359 +++ trunk/initscripts/sysvinit/rc/cleanfs 2011/06/04 21:59:16 1360 @@ -1,5 +1,5 @@ -#!/bin/bash -# $Id$ +#!/bin/sh +# $Header: /home/cvsd/magellan-cvs/magellan-src/busybox-initscripts/rc/cleanfs,v 1.2 2008-06-10 22:23:30 niro Exp $ #%rlevels: 7:s #%start: 50 @@ -13,33 +13,42 @@ source /etc/conf.d/rc source ${rc_functions} -for dir in /tmp /var/run /var/lock -do - rc_print "Removing tmp files in ${dir}/ ..." - for file in $(find ${dir} -type f) - do - [[ $(basename ${file}) = .keep ]] && continue - rm -f ${file} - done - for subdir in $(find ${dir} -mindepth 1 -type d) - do - [[ -f ${subdir}/.keep ]] && continue - rm -r ${subdir} - done - evaluate_retval -done - -rc_print "Creating new /var/run/utmp ..." -touch /var/run/utmp && chmod 644 /var/run/utmp -evaluate_retval - -rc_print "Creating new /var/run/wtmp ..." -touch /var/log/wtmp && chmod 644 /var/log/wtmp -evaluate_retval - -rc_print "Removing possible /etc/nologin /fastboot and /forcefsck ..." -rm -f /etc/nologin /fastboot /forcefsck -evaluate_retval - -update_svcstatus $1 -splash svc_started "$(basename $0)" 0 +case "$1" in + start) + for dir in /tmp /var/run /var/lock + do + rc_print "Removing tmp files in ${dir}/ ..." + for file in $(find ${dir} -type f) + do + [[ $(basename ${file}) = .keep ]] && continue + rm -f ${file} + done + for subdir in $(find ${dir} -mindepth 1 -type d) + do + [[ -f ${subdir}/.keep ]] && continue + rm -r ${subdir} + done + evaluate_retval + done + + rc_print "Creating new /var/run/utmp ..." + touch /var/run/utmp && chmod 644 /var/run/utmp + evaluate_retval + + rc_print "Creating new /var/run/wtmp ..." + touch /var/log/wtmp && chmod 644 /var/log/wtmp + evaluate_retval + + rc_print "Removing possible /etc/nologin /fastboot and /forcefsck ..." + rm -f /etc/nologin /fastboot /forcefsck + evaluate_retval + + update_svcstatus $1 + splash svc_started "$(basename $0)" 0 + ;; + + *) + rc_echo "Usage: $0 {start}" + exit 1 + ;; +esac