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
This commit is contained in:
1 file changed
+3
-2
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user