From 273384db045b310faa5916d38df6d7be4729083e Mon Sep 17 00:00:00 2001 From: osm0sis Date: Fri, 14 Feb 2020 13:33:41 -0400 Subject: Backend: fixes for booted flashing and addon.d-v2 - only do setup_env and restore_env when in recovery to prevent environment/mount issues post-install - use busybox [ for simple integer test to ensure known numerical operator behavior --- META-INF/com/google/android/update-binary | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'META-INF') diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary index 6946fef..55d7625 100755 --- a/META-INF/com/google/android/update-binary +++ b/META-INF/com/google/android/update-binary @@ -120,18 +120,16 @@ mount_all() { $BB mount -o bind /system_root/system /system; fi; fi; - $BOOTMODE || mount_apex; + mount_apex; } umount_all() { - (if ! $BOOTMODE; then - umount_apex; - if [ ! -d /postinstall/tmp ]; then - $BB umount /system; - $BB umount -l /system; - if [ -e /system_root ]; then - $BB umount /system_root; - $BB umount -l /system_root; - fi; + (umount_apex; + if [ ! -d /postinstall/tmp ]; then + $BB umount /system; + $BB umount -l /system; + if [ -e /system_root ]; then + $BB umount /system_root; + $BB umount -l /system_root; fi; fi; umount /vendor; @@ -142,7 +140,8 @@ umount_all() { fi) 2>/dev/null; } setup_env() { - $BOOTMODE || $BB mount -o bind /dev/urandom /dev/random; + $BOOTMODE && return 1; + $BB mount -o bind /dev/urandom /dev/random; umount_all; mount_all; OLD_LD_PATH=$LD_LIBRARY_PATH; @@ -166,6 +165,7 @@ setup_env() { fi; } restore_env() { + $BOOTMODE && return 1; local dir; unset -f getprop; test "$OLD_LD_PATH" && export LD_LIBRARY_PATH=$OLD_LD_PATH; @@ -224,7 +224,7 @@ do_devicecheck() { fi; } int2ver() { - if [ "$1" -eq "$1" ] 2>/dev/null; then + if $BB [ "$1" -eq "$1" ] 2>/dev/null; then echo "$1.0.0"; elif [ ! "$(echo "$1" | $BB cut -d. -f3)" ]; then echo "$1.0"; -- cgit v1.2.3