#!/sbin/runscript

depend() {
	need checkroot
}

start() {
	grep "/dev" /etc/fstab | grep -v "#" | grep ext2 > /dev/null 2> /dev/null
	if [ $? = 0 ]; then
		ebegin "Checking all filesystems"
		fsck -R -A -a
		if [ $? -eq 0 ]
		then
			eend 0
		elif [ $? -eq 1 ]
		then
			eend 1 "Filesystem errors corrected."
		else 
			eend 2 "Fsck could not correct all errors, manual repair needed"
			/sbin/sulogin $CONSOLE
		fi
	fi
	return
}