Home | History | Annotate | Download | only in utils
      1 #!/bin/bash
      2 #
      3 
      4 UTIL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
      5 
      6 if [ "$(which adb)" != "" ]; then
      7     ADB="$(which adb)"
      8 elif [ -d "$ANDROID_SDK_ROOT" ]; then
      9     ADB="${ANDROID_SDK_ROOT}/platform-tools/adb"
     10 else
     11   echo $ANDROID_SDK_ROOT
     12   echo "No ANDROID_SDK_ROOT set (check that android_setup.sh was properly sourced)"
     13   exit 1
     14 fi
     15 
     16 if [ ! -x $ADB ]; then
     17   echo "The adb binary is not executable"
     18   exit 1
     19 fi
     20 
     21 if [ $(uname) == "Linux" ]; then
     22   ADB_REQUIRED="1.0.32"
     23 elif [ $(uname) == "Darwin" ]; then
     24   ADB_REQUIRED="1.0.31 or 1.0.32"
     25 fi
     26 
     27 # get the version and then truncate it to be just the version numbers
     28 ADB_VERSION="$($ADB version)"
     29 ADB_VERSION="${ADB_VERSION##* }"
     30 
     31 if [[ "$ADB_REQUIRED" != *"$ADB_VERSION"* ]]; then
     32   echo "WARNING: Your ADB version is out of date!"
     33   echo "  Expected ADB Version: ${ADB_REQUIRED}"
     34   echo "  Actual ADB Version: ${ADB_VERSION}"
     35 fi
     36