mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
busybox/init: integer comparisons in fsck retval checks
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
This commit is contained in:
parent
efd28315ac
commit
b77ec0436a
@ -463,12 +463,12 @@ force_fsck() {
|
||||
read -t120 -n1
|
||||
# The exit status is 0 if input is available
|
||||
# The exit status is greater than 128 if the timeout is exceeded
|
||||
if [ "$?" -ne "0" -o "$?" -gt "128" ]; then
|
||||
if [ $? -ne 0 -o $? -gt 128 ]; then
|
||||
echo "Repairing filesystem..."
|
||||
echo ""
|
||||
/usr/sbin/fsck -T -M -y $RUN_FSCK_DISKS
|
||||
FSCK_RET="$?"
|
||||
if [ "$(( $FSCK_RET & 8 ))" = 8 ]; then
|
||||
FSCK_RET=$?
|
||||
if [ $(( $FSCK_RET & 8 )) -eq 8 ]; then
|
||||
# fubar
|
||||
echo "Forced fsck failed. Your system is broken beyond repair"
|
||||
echo "Please re-install @DISTRONAME@"
|
||||
@ -491,20 +491,20 @@ check_disks() {
|
||||
if [ "$RUN_FSCK" = "yes" -a -n "$RUN_FSCK_DISKS" ]; then
|
||||
progress "Checking disk(s): $RUN_FSCK_DISKS"
|
||||
/usr/sbin/fsck -T -M -p -a $RUN_FSCK_DISKS > /dev/null 2>&1
|
||||
FSCK_RET="$?"
|
||||
FSCK_RET=$?
|
||||
|
||||
# FSCK_RET is the bit-wise OR of the exit codes for each filesystem that is checked.
|
||||
if [ "$(( $FSCK_RET & 4 ))" = 4 ]; then
|
||||
if [ $(( $FSCK_RET & 4 )) -eq 4 ]; then
|
||||
# errors left
|
||||
force_fsck
|
||||
elif [ "$(( $FSCK_RET & 2 ))" = 2 ]; then
|
||||
elif [ $(( $FSCK_RET & 2 )) -eq 2 ]; then
|
||||
# reboot needed
|
||||
echo "Filesystem repaired, reboot needed..."
|
||||
do_reboot
|
||||
elif [ "$(( $FSCK_RET & 1 ))" = 1 ]; then
|
||||
elif [ $(( $FSCK_RET & 1 )) -eq 1 ]; then
|
||||
# filesystem errors corrected
|
||||
progress "Filesystem errors corrected , continuing..."
|
||||
elif [ "$(( $FSCK_RET & 0 ))" = 0 ]; then
|
||||
elif [ $(( $FSCK_RET & 0 )) -eq 0 ]; then
|
||||
# no errors found
|
||||
progress "No filesystem errors found, continuing..."
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user