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
gugelfrei
Adrian DC 6 years ago committed by Michael Bestas
parent d577325ae2
commit 6393a3f083

@ -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

Loading…
Cancel
Save