From 299137f39d6fa6445aef1efe3fda0e7a95a3535d Mon Sep 17 00:00:00 2001 From: Marc K Date: Thu, 20 Oct 2016 10:27:10 +0200 Subject: [PATCH 1/4] envsetup: dopush: fix test if device is in recovery Change-Id: I1687b879e00918813886b2c9c54535376aa62d99 Signed-off-by: Marc K --- build/envsetup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/envsetup.sh b/build/envsetup.sh index 2d60bc37..a5b8b970 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 From 2be9cac81b96aa8e51b601d7702c46ad77b59b8e Mon Sep 17 00:00:00 2001 From: Marc K Date: Thu, 20 Oct 2016 10:27:35 +0200 Subject: [PATCH 2/4] envsetup: dopush: allow (symbolic) host names for adb connect Change-Id: Icfab874abab64b0a3e5e63091cb6c25dd9630737 Signed-off-by: Marc K --- build/envsetup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/envsetup.sh b/build/envsetup.sh index a5b8b970..72bdfd40 100644 --- a/build/envsetup.sh +++ b/build/envsetup.sh @@ -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 From 97b035dd88ed44e64e1148d107ffe1c5f7babfc8 Mon Sep 17 00:00:00 2001 From: Marc K Date: Thu, 20 Oct 2016 10:27:44 +0200 Subject: [PATCH 3/4] envsetup: dopush: fix finding files to be pushed with ninja Change-Id: I27b4e62d08dcd2a6dc95519197c6284c8c44636d Signed-off-by: Marc K --- build/envsetup.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/build/envsetup.sh b/build/envsetup.sh index 72bdfd40..2fcd173f 100644 --- a/build/envsetup.sh +++ b/build/envsetup.sh @@ -813,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 From 13512fb86fc7a595783f7f91f74c9cf452c4bcb7 Mon Sep 17 00:00:00 2001 From: Adrian DC Date: Sun, 23 Oct 2016 18:37:13 +0200 Subject: [PATCH 4/4] backuptool: /system/addon.d explicit creation * Add the addon.d folder creation to preserve_addon_d before copying the files back to /system/addon.d * On CM based ROMs, the path exists for built elements, but on other AOSP-based ROMs where this script might be used, the folder might not be created on build and copy fails, breaking backuptool on second ROM update Change-Id: I7438823b8d7ad0972649d2bf491d0f6fe423bc99 --- prebuilt/common/bin/backuptool.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/prebuilt/common/bin/backuptool.sh b/prebuilt/common/bin/backuptool.sh index 5554835d..0af4c887 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