From da324c430ffb587087a26a9a57e89bb8eb0f4727 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Fri, 7 Jun 2019 17:03:38 -0300 Subject: [PATCH] Backend: fix debugging .tgz creation for booted installs - some apps copy the zip to be flashed to the app cache, which would result in the .tgz going either somewhere unknown/inaccessbile to the user or get deleted when the app cleans up after flash, so instead send to /sdcard if the device is booted to Android --- META-INF/com/google/android/update-binary | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary index d3059e1..fc3b94b 100755 --- a/META-INF/com/google/android/update-binary +++ b/META-INF/com/google/android/update-binary @@ -4,7 +4,11 @@ OUTFD=/proc/self/fd/$2; ZIPFILE="$3"; -DIR=$(dirname "$ZIPFILE"); + +ps | grep zygote | grep -v grep >/dev/null && BOOTMODE=true || BOOTMODE=false; +$BOOTMODE || ps -A 2>/dev/null | grep zygote | grep -v grep >/dev/null && BOOTMODE=true; + +$BOOTMODE && DIR=/sdcard || DIR=$(dirname "$ZIPFILE"); test "$home" || home=/tmp/anykernel; parent=$(dirname $home); @@ -33,7 +37,7 @@ cleanup() { debugging() { case $(basename "$ZIPFILE" .zip) in *-debugging) - ui_print " " "Creating debugging archive in zip directory..."; + ui_print " " "Creating debugging archive in $DIR..."; $bb tar -czvf "$DIR/anykernel3-$(date +%Y-%m-%d_%H%M%S)-debug.tgz" $parent/*; ;; esac;