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

Commit 6393a3f0 authored by Adrian DC's avatar Adrian DC Committed by Michael Bestas
Browse files

envsetup: Fix adb recovery state detections

 * The original commands were checking a file,
    and validating that adb ran without error,
    resulting in an always-true result

 * Fix eat and _adb_connected by properly
    checking the 'test -e' error code

Change-Id: I49f82f04f4b51097be76f03bf7021203665da76f
parent d577325a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -108,10 +108,10 @@ function eat()
            return 1
        fi
        adb start-server # Prevent unexpected starting server message from adb get-state in the next line
        if [ $(adb get-state) != device -a $(adb shell test -e /sbin/recovery 2> /dev/null; echo $?) != 0 ] ; then
        if [ $(adb get-state) != device -a $(adb shell 'test -e /sbin/recovery 2> /dev/null; echo $?') != 0 ] ; then
            echo "No device is online. Waiting for one..."
            echo "Please connect USB and/or enable USB debugging"
            until [ $(adb get-state) = device -o $(adb shell test -e /sbin/recovery 2> /dev/null; echo $?) = 0 ];do
            until [ $(adb get-state) = device -o $(adb shell 'test -e /sbin/recovery 2> /dev/null; echo $?') = 0 ];do
                sleep 1
            done
            echo "Device Found.."
@@ -782,7 +782,7 @@ function repodiff() {
function _adb_connected {
    {
        if [[ "$(adb get-state)" == device &&
              "$(adb shell test -e /sbin/recovery; echo $?)" != 0 ]]
              "$(adb shell 'test -e /sbin/recovery; echo $?')" != 0 ]]
        then
            return 0
        fi