[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 a81ef58501
2 changed files with 30 additions and 3 deletions

View file

@ -118,10 +118,11 @@ pblock() {
}
get_mb_ver() {
[ -z "$1" ] && return 420
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')" -ge "$minmajor" ] && \
[ "$(get_mb_ver '1')" -ge "$minminor" ] && \
[ "$(get_mb_ver '2')" -gt "$minpatch" ] \
] || {
info "[parser] skipping [$pname] as current version is lower than patch version clamp"
continue ; }
} || :
[ -n "$maxver" ] && {
[ "$(get_mb_ver)" -lt "$maxver" ] || {
chk="${minver//[^.]}"
[ "${#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')" -le "$maxmajor" ] && \
[ "$(get_mb_ver '1')" -le "$maxminor" ] && \
[ "$(get_mb_ver '2')" -lt "$maxpatch" ] \
] || {
info "[parser] skipping [$pname] as current version is higher than patch version clamp"
continue ; }
} || :