[1/2] feat: {parse.sh, common.sh}: "y2k" support

parse whole version, avoid potential patches leak when, for example, 6.5.0 lands

get_mb_ver now must have an argument,
for any usage outside of what ive grep'd, to retain the previous behavior, pass '2'

Signed-off-by: fukiame <fukiame@proton.me>
This commit is contained in:
Hikarie Fukirei 2026-02-07 22:08:49 +07:00
commit aa5fa10055
2 changed files with 30 additions and 3 deletions

View file

@ -126,10 +126,11 @@ pblock() {
}
get_mb_ver() {
[ -z "$1" ] && return 42
a="$(grep -m1 'android:versionName' "$DIRPATH"/mbapk/mbapk_unpacked/AndroidManifest.xml | tr ' ' '\n' | grep -m1 'android:versionName')"
a="$(bb_split "$a" '=' '1')"
a="$(strip_all "$a" '"')"
bb_split "$a" '.' '2'
bb_split "$a" '.' "$1"
}
good() {

View file

@ -77,12 +77,38 @@ for f in patches/*.sh ; do
continue
}
[ -n "$minver" ] && {
[ "$(get_mb_ver)" -gt "$minver" ] || {
chk="${minver//[^.]}"
[ "${#chk}" -ne 2 ] && {
warn "[parser] skipping [$pname] with malformed minver"
continue
}
minmajor="$(bb_split "$minver" '.' '0')"
minminor="$(bb_split "$minver" '.' '1')"
minpatch="$(bb_split "$minver" '.' '2')"
[ "$(( \
$(get_mb_ver 0) * 10000 + $(get_mb_ver 1) * 100 + $(get_mb_ver 2) ))" -lt \
"$(( minmajor * 10000 + minminor * 100 + minpatch ))" \
] && {
info "[parser] skipping [$pname] as current version is lower than patch version clamp"
continue ; }
} || :
[ -n "$maxver" ] && {
[ "$(get_mb_ver)" -lt "$maxver" ] || {
chk="${maxver//[^.]}"
[ "${#chk}" -ne 2 ] && {
warn "[parser] skipping [$pname] with malformed maxver"
continue
}
maxmajor="$(bb_split "$maxver" '.' '0')"
maxminor="$(bb_split "$maxver" '.' '1')"
maxpatch="$(bb_split "$maxver" '.' '2')"
[ "$(( \
$(get_mb_ver 0) * 10000 + $(get_mb_ver 1) * 100 + $(get_mb_ver 2) ))" -gt \
"$(( maxmajor * 10000 + maxminor * 100 + maxpatch ))" \
] && {
info "[parser] skipping [$pname] as current version is higher than patch version clamp"
continue ; }
} || :