diff options
author | osm0sis <osm0sis@outlook.com> | 2019-01-02 17:08:22 -0400 |
---|---|---|
committer | osm0sis <osm0sis@outlook.com> | 2019-01-02 17:08:22 -0400 |
commit | a1f20c0d53a09b69a6cd769b6fc9a78f6a27246a (patch) | |
tree | e5a388bdd19837a9883f498759c59e531c8d9576 /META-INF | |
parent | 34d8a65fbe834638cebcf23de5bb1a1335dfc590 (diff) |
Backend: support all half-sensible ROM version formats
9
9.0
9.0.0
Anything else is insanity.
Diffstat (limited to 'META-INF')
-rwxr-xr-x | META-INF/com/google/android/update-binary | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary index bd65e1d..bea525d 100755 --- a/META-INF/com/google/android/update-binary +++ b/META-INF/com/google/android/update-binary @@ -14,6 +14,15 @@ ui_print() { } show_progress() { echo "progress $1 $2" > $OUTFD; } file_getprop() { $bb grep "^$2=" "$1" | $bb cut -d= -f2-; } +int2ver() { + if [ "$1" -eq "$1" ] 2>/dev/null; then + echo "$1.0.0"; + elif [ ! "$(echo "$1" | $bb cut -d. -f3)" ]; then + echo "$1.0"; + else + echo "$1"; + fi; +} cleanup() { cd /tmp; rm -rf /tmp/anykernel; @@ -128,7 +137,6 @@ 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..."; @@ -136,12 +144,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 "$(int2float $hi_ver)\n$(int2float $lo_ver)\n$(int2float $android_ver)" | $bb sort -g | $bb grep -n "$(int2float $android_ver)" | $bb grep '^2:')" ]; then + if [ "$(echo -e "$(int2ver $hi_ver)\n$(int2ver $lo_ver)\n$(int2ver $android_ver)" | $bb sort -g | $bb grep -n "$(int2ver $android_ver)" | $bb grep '^2:')" ]; then supported=1; fi; else for ver in $(echo $supported_ver | $bb sed 's;,; ;g'); do - if [ "$(int2float $ver)" == "$(int2float $android_ver)" ]; then + if [ "$(int2ver $ver)" == "$(int2ver $android_ver)" ]; then supported=1; break; fi; |