Merge pull request #3868 from mglae/le92_fsck

init: fsck: wait for devices and unhide messages
This commit is contained in:
CvH 2019-10-14 20:55:49 +02:00 committed by GitHub
commit 98394a9d5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -499,24 +499,42 @@ force_fsck() {
check_disks() { check_disks() {
if [ "$RUN_FSCK" = "yes" -a -n "$RUN_FSCK_DISKS" ]; then if [ "$RUN_FSCK" = "yes" -a -n "$RUN_FSCK_DISKS" ]; then
progress "Checking disk(s): $RUN_FSCK_DISKS" progress "Checking disk(s): $RUN_FSCK_DISKS"
/usr/sbin/fsck -T -M -p -a $RUN_FSCK_DISKS > /dev/null 2>&1 echo "Checking disk(s): $RUN_FSCK_DISKS" >/dev/kmsg
FSCK_RET=$? for i in 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0; do
/usr/sbin/fsck -T -M -p -a $RUN_FSCK_DISKS >/dev/fsck.latest 2>&1
FSCK_RET=$?
cat /dev/fsck.latest >>/dev/fsck.log
# FSCK_RET is the bit-wise OR of the exit codes for each filesystem that is checked. # FSCK_RET is the bit-wise OR of the exit codes for each filesystem that is checked.
if [ $(( $FSCK_RET & 4 )) -eq 4 ]; then if [ $FSCK_RET -ge 16 ]; then
# errors left progress "General error, continuing..."
force_fsck break
elif [ $(( $FSCK_RET & 2 )) -eq 2 ]; then elif [ $(( $FSCK_RET & 8 )) -eq 8 ]; then
# reboot needed # device not found
echo "Filesystem repaired, reboot needed..." if [ $i -eq 0 ]; then
do_reboot progress "Device not found, continuing..."
elif [ $(( $FSCK_RET & 1 )) -eq 1 ]; then else
# filesystem errors corrected usleep 500000
progress "Filesystem errors corrected , continuing..." fi
elif [ $(( $FSCK_RET & 0 )) -eq 0 ]; then elif [ $(( $FSCK_RET & 4 )) -eq 4 ]; then
# no errors found # errors left
progress "No filesystem errors found, continuing..." force_fsck
fi elif [ $(( $FSCK_RET & 2 )) -eq 2 ]; then
# reboot needed
echo "Filesystem repaired, reboot needed..."
do_reboot
elif [ $(( $FSCK_RET & 1 )) -eq 1 ]; then
# filesystem errors corrected
progress "Filesystem errors corrected , continuing..."
break
elif [ $FSCK_RET -eq 0 ]; then
# no errors found
progress "No filesystem errors found, continuing..."
break
fi
done
sed -e '/^$/d' -e 's/^/fsck: /' </dev/fsck.latest >/dev/kmsg
rm -f /dev/fsck.latest
fi fi
} }