From 34d8a65fbe834638cebcf23de5bb1a1335dfc590 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Thu, 20 Dec 2018 13:46:52 -0400 Subject: [PATCH] Backend: workaround bad ROM versioning practices in supported check - some ROMs have taken it upon themselves to go against AOSP, i.e. where starting with Pie AOSP now versions it as only 9, some ROMs are still making it 9.0 - introduce integer 2 float function that will add a decimal place to all for comparisons - this should support the majority of ROMs, but anything crazy like 9.0.0, or crazier like 09.0.0 should be frowned upon by the community and the ROM devs should be made to get it together and follow AOSP --- META-INF/com/google/android/update-binary | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary index 0d66cf5..bd65e1d 100755 --- a/META-INF/com/google/android/update-binary +++ b/META-INF/com/google/android/update-binary @@ -128,6 +128,7 @@ if [ "$(file_getprop anykernel.sh do.devicecheck)" == 1 ]; then fi; fi; +int2float() { test "$1" -eq "$1" 2>/dev/null && $bb printf '%0.1f\n' "$1" || echo "$1"; } supported_ver="$(file_getprop anykernel.sh supported.versions | $bb tr -d '[:space:]')"; if [ "$supported_ver" ]; then ui_print "Checking Android version..."; @@ -135,12 +136,12 @@ if [ "$supported_ver" ]; then if [ "$(echo $supported_ver | $bb grep -)" ]; then lo_ver=$(echo $supported_ver | $bb cut -d- -f1); hi_ver=$(echo $supported_ver | $bb cut -d- -f2); - if [ "$(echo -e "$hi_ver\n$lo_ver\n$android_ver" | $bb sort -g | $bb grep -n "$android_ver" | $bb grep '^2:')" ]; then + if [ "$(echo -e "$(int2float $hi_ver)\n$(int2float $lo_ver)\n$(int2float $android_ver)" | $bb sort -g | $bb grep -n "$(int2float $android_ver)" | $bb grep '^2:')" ]; then supported=1; fi; else for ver in $(echo $supported_ver | $bb sed 's;,; ;g'); do - if [ "$ver" == "$android_ver" ]; then + if [ "$(int2float $ver)" == "$(int2float $android_ver)" ]; then supported=1; break; fi;