#! /bin/sh

# fsck-all: System initialization script 

if [ "$1" != "start" ]; then exit 0; fi

. init-script-lib

fatal need devfs

important fsck -a -A -V -C
# -a: repair things without asking
# -A: all filesystems in fstab
# -C: show progress bars
# -V: verbose

if [ $? -gt 1 ] ; then

# can't use HERE documents as they are implemented as writing to a 
# temporary file.

	echo "**************************************************"
	echo	Code
	echo	"0 	No errors"
	echo	"1 	File system errors corrected"
	echo	"2 	System should be rebooted"
	echo	"4 	File system errors left uncorrected"
	echo	"8 	Operational error"
	echo	"16 	Usage or syntax error"
	echo	"128 	Shared library error"
	echo ""
	echo "Codes from fsck(8) manpage of E2fsprogs 1.19."
	echo ""
	echo "**************************************************"

	say starting console

	sulogin || bash || sh || exit 1
	exec $0 start
fi
    
exit 0
