Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cfa214a4 authored by Pawit Pornkitprasan's avatar Pawit Pornkitprasan
Browse files

Fixed eat not waiting for device if adb server was not started



$(adb get-state) returned unexpected starting server message
causing the if statement to fail. Calling "adb start-server"
beforehand remedies that.

Patch Set 2:
$(adb get-state) returns 'unknown' if Clockwork recovery is running on the device
look for /sbin/recovery and 'pass' the state test
also
adb wait-for-device
will result in endless loop, replace with until loop using with get-state OR 'recovery' tests

Patch Set 3:
fix the initial adb state test, use AND instead of OR

Patch Set 4:
Rebased and prevent "device not found" message from spamming the screen by
redirecting error output to null

Change-Id: I2d41b8853567cde80bf7fc08b5e4f0ad5ba1fdf5
Signed-off-by: default avatarFirerat <firer4t@googlemail.com>
parent 7f863dab
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -642,9 +642,14 @@ function eat()
            echo "Nothing to eat"
            return 1
        fi
        if [ $(adb get-state) != device ] ; then
        adb start-server # Prevent unexpected starting server message from adb get-state in the next line
        if [ $(adb get-state) != device -a $(adb shell busybox test -e /sbin/recovery 2> /dev/null; echo $?) != 0 ] ; then
            echo "No device is online. Waiting for one..."
            adb wait-for-device
            echo "Please connect USB and/or enable USB debugging"
            until [ $(adb get-state) = device -o $(adb shell busybox test -e /sbin/recovery 2> /dev/null; echo $?) = 0 ];do
                sleep 1
            done
            echo "Device Found.."
        fi
        echo "Pushing $ZIPFILE to device"
        if adb push $ZIPPATH /mnt/sdcard/ ; then