Create a new file /etc/init.d/checkfs containing the following:
#!/bin/sh
# Begin /etc/init.d/checkfs
source /etc/init.d/functions
echo -n "Activating swap..."
/sbin/swapon -a
evaluate_retval
if [ -f /fastboot ]
then
echo "Fast boot, no file system check"
rm /fastboot
else
/bin/mount -n -o remount,ro /
if [ $? = 0 ]
then
if [ -f /forcefsck ]
then
echo "/forcefsck exists, forcing file system check"
force="-f"
else
force=""
fi
echo "Checking file systems..."
/sbin/fsck $force -a -A -C -T -V
if [ $? -gt 1 ]
then
$FAILURE
echo
echo -n "fsck failed. Please repair your file "
echo "systems manually by running /sbin/fsck"
echo "without the -a option"
echo
echo -n "Please note that the root file system is "
echo "currently mounted in read-only mode."
echo
echo -n "I will start sulogin now. When you "
echo "logout I will reboot your system."
echo
$NORMAL
/sbin/sulogin
/sbin/reboot -f
else
print_status success
fi
else
echo -n "Cannot check root file system because it "
echo "could not be mounted in read-only mode."
fi
fi
# End /etc/init.d/checkfs