2 ########################################################################
5 # Description : Clean file system
7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
8 # DJ Lucas - dj@linuxfromscratch.org
9 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
13 ########################################################################
17 # Required-Start: $local_fs
23 # Short-Description: Cleans temporary directories early in the boot process.
24 # Description: Cleans temporary directories /run, /var/lock, and
25 # optionally, /tmp. cleanfs also creates /run/utmp
26 # and any files defined in /etc/sysconfig/createfiles.
27 # X-LFS-Provided-By: LFS
30 .
/lib
/lsb
/init-functions
32 # Function to create files/directory on boot.
35 # Input to file descriptor 9 and output to stdin (redirection)
36 exec 9>&0 < /etc
/sysconfig
/createfiles
38 while read name
type perm usr grp dtype maj min junk
40 # Ignore comments and blank lines.
45 # Ignore existing files.
46 if [ ! -e "${name}" ]; then
47 # Create stuff based on its type.
58 mknod
"${name}" c ${maj} ${min}
61 mknod "${name}" b ${maj} ${min}
67 log_warning_msg
"\nUnknown device type: ${dtype}"
72 log_warning_msg
"\nUnknown type: ${type}"
77 # Set up the permissions, too.
78 chown
${usr}:${grp} "${name}"
79 chmod ${perm} "${name}"
83 # Close file descriptor 9 (end redirection)
90 log_info_msg "Cleaning
file systems
:"
92 if [ "${SKIPTMPCLEAN}" = "" ]; then
95 find . -xdev -mindepth 1 ! -name lost+found -delete || failed=1
100 if grep -q '^utmp:' /etc/group ; then
108 if egrep -qv '^(#|$)' /etc/sysconfig/createfiles 2>/dev/null; then
109 log_info_msg "Creating files and directories...
"
110 create_files # Always returns 0
117 echo "Usage
: ${0} {start
}"