summaryrefslogtreecommitdiffstats
path: root/envsetup.sh
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2016-02-06 01:32:33 +0100
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2016-02-06 01:32:33 +0100
commitf24daeff7d5826dbf1efed77fccc7836589e72da (patch)
tree1677e3c290e09777d867015abe0edc4fbbe7ba74 /envsetup.sh
parente54842b94599c3a4bd6cd5b9dd1cf9d7a718e552 (diff)
parentd063c0fb4e0c9d06eaff35d2bdfa1678b30c3c35 (diff)
downloadbuild-f24daeff7d5826dbf1efed77fccc7836589e72da.zip
build-f24daeff7d5826dbf1efed77fccc7836589e72da.tar.gz
build-f24daeff7d5826dbf1efed77fccc7836589e72da.tar.bz2
Merge branch 'cm-13.0' of https://github.com/CyanogenMod/android_build into replicant-6.0
Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Diffstat (limited to 'envsetup.sh')
-rw-r--r--envsetup.sh17
1 files changed, 15 insertions, 2 deletions
diff --git a/envsetup.sh b/envsetup.sh
index 517573f..bb46faf 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -2182,6 +2182,19 @@ function repodiff() {
'echo "$REPO_PATH ($REPO_REMOTE)"; git diff ${diffopts} 2>/dev/null ;'
}
+# Return success if adb is up and not in recovery
+function _adb_connected {
+ {
+ if [[ "$(adb get-state)" == device &&
+ "$(adb shell test -e /sbin/recovery; echo $?)" == 0 ]]
+ then
+ return 0
+ fi
+ } 2>/dev/null
+
+ return 1
+};
+
# Credit for color strip sed: http://goo.gl/BoIcm
function dopush()
{
@@ -2189,10 +2202,10 @@ function dopush()
shift
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_connected; 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_connected; do
sleep 1
done
echo "Device Found."