diff options
author | osm0sis <osm0sis@outlook.com> | 2018-12-20 13:46:52 -0400 |
---|---|---|
committer | osm0sis <osm0sis@outlook.com> | 2018-12-20 13:46:52 -0400 |
commit | 34d8a65fbe834638cebcf23de5bb1a1335dfc590 (patch) | |
tree | e18f5dccb6723476579b6c28f60e30933b052f54 /META-INF | |
parent | 9d49de1caf38ab0c186a26430894974496992e06 (diff) |
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
Diffstat (limited to 'META-INF')
-rwxr-xr-x | META-INF/com/google/android/update-binary | 5 |
1 files 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; |