#RC:RUNINRC

# If old file exists, whine until they fix it.
if [ -f /etc/sysconfig ]; then
	echo "Warning: /etc/sysconfig has been replaced by /etc/rc.conf."
	echo "You should switch to /etc/rc.conf ASAP to eliminate this warning."
fi

adjkerntz -i

clean_var() {
	if [ ! -f /var/run/clean_var ]; then
		rm -rf /var/run/*
		rm -f /var/spool/lock/*
		rm -rf /var/spool/uucp/.Temp/*
		# Keep a copy of the boot messages around
		dmesg >/var/run/dmesg.boot
		# And an initial utmp file
		(cd /var/run && cp /dev/null utmp && chmod 644 utmp; )
		>/var/run/clean_var
	fi
}

if [ -d /var/run -a -d /var/spool/lock -a -d /var/spool/uucp/.Temp ]; then
	# network_pass1() *may* end up writing stuff to /var - we don't want to
	# remove it immediately afterwards - *nor* to we want to fail to clean
	# an nfs-mounted /var.
	clean_var
fi

# Add additional swapfile, if configured.
if [ "x$swapfile" != "xNO" -a -w "$swapfile" -a -b /dev/vn0b ]; then
	echo "Adding $swapfile as additional swap."
	vnconfig /dev/vn0b $swapfile && swapon /dev/vn0b
fi

