#!/bin/sh
#RC:RUNINRC
#RC:AFTER remotefs
#
# Clean up, as part of the startup
#

# Whack the pty perms back into shape.
chmod 666 /dev/tty[pqrsPQRS]*

# clean up left-over files
rm -f /etc/nologin

clean_var			# If it hasn't already been done
rm /var/run/clean_var

#
# Clearing /tmp at boot-time seems to have a long tradition.  It doesn't
# help in any way for long-living systems, and it might accidentally
# clobber files you would rather like to have preserved after a crash
# (if not using mfs /tmp anyway).
#
# See also the example of another cleanup policy in /etc/periodic/daily.
#
if [ "X${clear_tmp_enable}" = X"YES" ]; then
	echo clearing /tmp

	# prune quickly with one rm, then use find to clean up /tmp/[lq]*
	# (not needed with mfs /tmp, but doesn't hurt there...)
	(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
		find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;)

fi

# Remove X lock files, since they will prevent you from restarting X11 
# after a system crash.
rm -f /tmp/.X*-lock /tmp/.X11-unix/*

