diff --git a/build/envsetup.sh b/build/envsetup.sh index 3adae2e4..35591495 100644 --- a/build/envsetup.sh +++ b/build/envsetup.sh @@ -96,30 +96,29 @@ function eat() done echo "Device Found.." fi - if (adb shell getprop ro.cm.device | grep -q "$CM_BUILD"); - then - # if adbd isn't root we can't write to /cache/recovery/ - adb root - sleep 1 - adb wait-for-device - cat << EOF > /tmp/command + if (adb shell getprop ro.cm.device | grep -q "$CM_BUILD"); then + # if adbd isn't root we can't write to /cache/recovery/ + adb root + sleep 1 + adb wait-for-device + cat << EOF > /tmp/command --sideload_auto_reboot EOF - if adb push /tmp/command /cache/recovery/ ; then - echo "Rebooting into recovery for sideload installation" - adb reboot recovery - adb wait-for-sideload - adb sideload $ZIPPATH + if adb push /tmp/command /cache/recovery/ ; then + echo "Rebooting into recovery for sideload installation" + adb reboot recovery + adb wait-for-sideload + adb sideload $ZIPPATH + fi + rm /tmp/command + else + echo "The connected device does not appear to be $CM_BUILD, run away!" fi - rm /tmp/command + return $? else echo "Nothing to eat" return 1 fi - return $? - else - echo "The connected device does not appear to be $CM_BUILD, run away!" - fi } function omnom()