64 lines
1.6 KiB
Bash
64 lines
1.6 KiB
Bash
#!/bin/sh
|
|
########################################################################
|
|
# Begin cleanfs
|
|
#
|
|
# Description : Clean file system
|
|
#
|
|
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
|
|
# DJ Lucas - dj@linuxfromscratch.org
|
|
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
|
|
#
|
|
# Version : LFS 7.0
|
|
#
|
|
########################################################################
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: cleanfs
|
|
# Required-Start: $local_fs
|
|
# Should-Start:
|
|
# Required-Stop:
|
|
# Should-Stop:
|
|
# Default-Start: S
|
|
# Default-Stop:
|
|
# Short-Description: Cleans temporary directories early in the boot process.
|
|
# Description: Cleans /var/lock, /var/run, and /tmp. Also creates
|
|
# /var/run/utmp
|
|
# X-LFS-Provided-By: LFS
|
|
### END INIT INFO
|
|
|
|
. /lib/lsb/init-functions
|
|
|
|
case "${1}" in
|
|
start)
|
|
log_info_msg "Cleaning file systems:"
|
|
|
|
if [ "${SKIPTMPCLEAN}" = "" ]; then
|
|
log_info_msg2 " /tmp"
|
|
cd /tmp &&
|
|
find . -xdev -mindepth 1 ! -name lost+found -delete || failed=1
|
|
cd /var/lock &&
|
|
find . -xdev -mindepth 1 ! -name lost+found -delete || failed=1
|
|
cd /var/run &&
|
|
find . -xdev -mindepth 1 ! -name lost+found -delete || failed=1
|
|
fi
|
|
|
|
> /var/run/utmp
|
|
|
|
if grep -q '^utmp:' /etc/group ; then
|
|
chmod 664 /var/run/utmp
|
|
chgrp utmp /var/run/utmp
|
|
fi
|
|
|
|
(exit ${failed})
|
|
evaluate_retval
|
|
|
|
exit $failed
|
|
;;
|
|
*)
|
|
echo "Usage: ${0} {start}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# End cleanfs
|