summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorosm0sis <osm0sis@outlook.com>2019-06-07 17:03:38 -0300
committerosm0sis <osm0sis@outlook.com>2019-06-07 20:22:03 -0300
commitda324c430ffb587087a26a9a57e89bb8eb0f4727 (patch)
tree37f460fa51bc559bcc37ab2022a600bc62333489
parent76d59d67e62592b1519a7f42c4489dcd4a06286d (diff)
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
-rwxr-xr-xMETA-INF/com/google/android/update-binary8
1 files 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;