checkfs: use bitwise check to correctly match e2fsck errors (and fix reboot when needed)

This commit is contained in:
Silvan Calarco 2011-11-14 17:17:39 +01:00
parent e8ed531999
commit 9afe8a664d

View File

@ -4,6 +4,7 @@
# Based on checkfs script from LFS-3.1 and earlier. # Based on checkfs script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
# Patch to handle all fsck variants by A. Luebke - luebke@users.sourceforge.net # Patch to handle all fsck variants by A. Luebke - luebke@users.sourceforge.net
# Modified and maintained for openmamba by Silvan Calarco <silvan.calarco@mambasoft.it>
. /etc/sysconfig/rc . /etc/sysconfig/rc
. $rc_functions . $rc_functions
@ -51,16 +52,7 @@ if [ $retval -eq 0 ]; then
$PLYMOUTH message --text=$"Checking file systems...done" $PLYMOUTH message --text=$"Checking file systems...done"
echo_success echo_success
echo echo
elif [ $retval -eq 1 ]; then elif [ $(($retval & 2)) -eq 2 ]; then
$WARNING
echo "File system errors were found and have been corrected."
echo "You may want to double-check that everything was fixed"
echo -n "properly"
$NORMAL
$PLYMOUTH message --text=$"Checking file systems...fixed"
echo_warning
echo
elif [ $retval -eq 2 ]; then
$WARNING $WARNING
echo "File system errors were found and have been corrected, but" echo "File system errors were found and have been corrected, but"
echo "the nature of the errors require this system to be rebooted." echo "the nature of the errors require this system to be rebooted."
@ -69,7 +61,7 @@ elif [ $retval -eq 2 ]; then
echo_warning echo_warning
echo echo
$rc_base/init.d/reboot $rc_base/init.d/reboot
elif [ $retval -eq 4 ]; then elif [ $(($retval & 4)) -eq 4 ]; then
$WARNING $WARNING
echo "File system errors were encountered that couldn't be" echo "File system errors were encountered that couldn't be"
echo "fixed automatically. The system will continue to boot but" echo "fixed automatically. The system will continue to boot but"
@ -78,13 +70,22 @@ elif [ $retval -eq 4 ]; then
$PLYMOUTH message --text=$"Checking file systems...unfixable errors" $PLYMOUTH message --text=$"Checking file systems...unfixable errors"
echo_warning echo_warning
echo echo
elif [ "$retval" -gt 4 ]; then elif [ $(($retval & 1)) -eq 1 ]; then
$WARNING
echo "File system errors were found and have been corrected."
echo "You may want to double-check that everything was fixed"
echo -n "properly"
$NORMAL
$PLYMOUTH message --text=$"Checking file systems...fixed"
echo_warning
echo
else
$FAILURE $FAILURE
echo "An internal error was encountered while checking file systems." echo "An internal error was encountered while checking file systems."
echo "This system will continue to boot but errors need to be fixed" echo "This system will continue to boot but errors need to be fixed"
echo "by a system administrator." echo "by a system administrator."
$NORMAL $NORMAL
$PLYMOUTH message --text=$"Checking file systems...operational error!" $PLYMOUTH message --text=$"Checking file systems...operational error!"" (retval=$retval)"
echo_warning echo_warning
echo echo
fi fi