2 # Begin $rc_base/init.d/cleanfs - Clean file system
4 # Written by Gerard Beekmans - gerard@linuxfromscratch.org
9 # Function to create files/directory on boot.
11 # Read in the configuration file.
12 exec 9>&0 < /etc
/sysconfig
/createfiles
13 while read name
type perm usr grp dtype maj min junk
; do
15 # Ignore comments and blank lines.
20 # Ignore existing files.
21 if [ ! -e "$name" ]; then
22 # Create stuff based on its type.
27 char
) mknod
"$name" c
$maj $min ;;
28 block
) mknod
"$name" b
$maj $min ;;
29 pipe
) mknod
"$name" p
;;
31 *) echo "Unknown type: $type" >&2
35 # Set up the permissions, too.
36 chown
$usr:$grp "$name"
45 echo "Removing /var/run/* and /var/lock/*"
46 rm -rf /var
/run
/* /var
/lock
/*
49 echo "Creating new /var/run/utmp..."
50 > /var
/run
/utmp
&& chmod 644 /var
/run
/utmp
53 echo "Removing possible /etc/nologin /fastboot and /forcefsck..."
54 rm -f /etc
/nologin
/fastboot
/forcefsck
57 echo "Removing /tmp/*"
58 find /tmp
-xdev -mindepth 1 -depth ! -path '/tmp/lost+found*' \
62 if [ -r /etc
/sysconfig
/createfiles
]; then
63 echo "Creating files and directories..."
69 echo "Usage: $0 {start}"
74 # End $rc_base/init.d/cleanfs