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
This commit is contained in:
osm0sis committed 2020-02-14 13:33:41 -04:00
1 parent 5bec49dc98
commit 273384db04
1 file changed
+6 -6
+6 -6
View File
@@ -120,11 +120,10 @@ mount_all() {
$BB mount -o bind /system_root/system /system;
fi;
fi;
$BOOTMODE || mount_apex;
mount_apex;
}
umount_all() {
(if ! $BOOTMODE; then
umount_apex;
(umount_apex;
if [ ! -d /postinstall/tmp ]; then
$BB umount /system;
$BB umount -l /system;
@@ -133,7 +132,6 @@ umount_all() {
$BB umount -l /system_root;
fi;
fi;
fi;
umount /vendor;
umount -l /vendor;
if [ "$UMOUNT_DATA" ]; then
@@ -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";