diff --git a/build/envsetup.sh b/build/envsetup.sh index 2d60bc37..2fcd173f 100644 --- a/build/envsetup.sh +++ b/build/envsetup.sh @@ -761,7 +761,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 @@ -789,7 +789,8 @@ function dopush() if (adb shell getprop ro.cm.device | grep -q "$CM_BUILD") || [ "$FORCE_PUSH" = "true" ]; then # retrieve IP and PORT info if we're using a TCP connection - TCPIPPORT=$(adb devices | egrep '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+[^0-9]+' \ + TCPIPPORT=$(adb devices \ + | egrep '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]):[0-9]+[^0-9]+' \ | head -1 | awk '{print $1}') adb root &> /dev/null sleep 0.3 @@ -812,16 +813,20 @@ function dopush() # Install: if [ `uname` = "Linux" ]; then - LOC="$(cat $OUT/.log | sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | grep '^Install: ' | cut -d ':' -f 2)" + LOC="$(cat $OUT/.log | sed -r -e 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' -e 's/^\[ {0,2}[0-9]{1,3}% [0-9]{1,6}\/[0-9]{1,6}\] +//' \ + | grep '^Install: ' | cut -d ':' -f 2)" else - LOC="$(cat $OUT/.log | sed -E "s/"$'\E'"\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g" | grep '^Install: ' | cut -d ':' -f 2)" + LOC="$(cat $OUT/.log | sed -E "s/"$'\E'"\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g" -E "s/^\[ {0,2}[0-9]{1,3}% [0-9]{1,6}\/[0-9]{1,6}\] +//" \ + | grep '^Install: ' | cut -d ':' -f 2)" fi # Copy: if [ `uname` = "Linux" ]; then - LOC="$LOC $(cat $OUT/.log | sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | grep '^Copy: ' | cut -d ':' -f 2)" + LOC="$LOC $(cat $OUT/.log | sed -r -e 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' -e 's/^\[ {0,2}[0-9]{1,3}% [0-9]{1,6}\/[0-9]{1,6}\] +//' \ + | grep '^Copy: ' | cut -d ':' -f 2)" else - LOC="$LOC $(cat $OUT/.log | sed -E "s/"$'\E'"\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g" | grep '^Copy: ' | cut -d ':' -f 2)" + LOC="$LOC $(cat $OUT/.log | sed -E "s/"$'\E'"\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g" -E 's/^\[ {0,2}[0-9]{1,3}% [0-9]{1,6}\/[0-9]{1,6}\] +//' \ + | grep '^Copy: ' | cut -d ':' -f 2)" fi # If any files are going to /data, push an octal file permissions reader to device diff --git a/prebuilt/common/bin/backuptool.sh b/prebuilt/common/bin/backuptool.sh index 21c6ca4a..fe8ca43a 100755 --- a/prebuilt/common/bin/backuptool.sh +++ b/prebuilt/common/bin/backuptool.sh @@ -22,6 +22,7 @@ preserve_addon_d() { # Restore /system/addon.d from /tmp/addon.d restore_addon_d() { if [ -d /tmp/addon.d/ ]; then + mkdir -p /system/addon.d/ cp -a /tmp/addon.d/* /system/addon.d/ rm -rf /tmp/addon.d/ fi