Get WSA version before extract

This commit is contained in:
Howard20181 2023-01-11 17:27:06 +08:00
parent d41bee363b
commit 3c7be0aa1c
2 changed files with 42 additions and 7 deletions

View File

@ -375,7 +375,7 @@ if [ -z "${OFFLINE+x}" ]; then
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source "${WORK_DIR:?}/ENV" || abort source "${WORK_DIR:?}/ENV" || abort
else else
DOWN_WSA_MAIN_VERSION=2211 DOWN_WSA_MAIN_VERSION=$(python3 getWSAMainVersion.py "$ARCH" "$WSA_ZIP_PATH")
fi fi
if [[ "$DOWN_WSA_MAIN_VERSION" -lt 2211 ]]; then if [[ "$DOWN_WSA_MAIN_VERSION" -lt 2211 ]]; then
ANDROID_API=32 ANDROID_API=32
@ -394,8 +394,8 @@ if [ -z "${OFFLINE+x}" ]; then
exit 1 exit 1
fi fi
else # Offline mode else # Offline mode
# TODO: Removed after Android 13 was released to the retail channel DOWN_WSA_MAIN_VERSION=$(python3 getWSAMainVersion.py "$ARCH" "$WSA_ZIP_PATH")
if [ "$RELEASE_TYPE" = "retail" ]; then if [[ "$DOWN_WSA_MAIN_VERSION" -lt 2211 ]]; then
ANDROID_API=32 ANDROID_API=32
update_gapps_zip_name update_gapps_zip_name
fi fi
@ -429,10 +429,6 @@ if [ -f "$WSA_ZIP_PATH" ]; then
echo -e "Extract done\n" echo -e "Extract done\n"
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source "${WORK_DIR:?}/ENV" || abort source "${WORK_DIR:?}/ENV" || abort
if [[ "$WSA_MAIN_VER" -ge 2211 ]]; then
ANDROID_API=33
update_gapps_zip_name
fi
else else
echo "The WSA zip package does not exist, is the download incomplete?" echo "The WSA zip package does not exist, is the download incomplete?"
exit 1 exit 1

View File

@ -0,0 +1,39 @@
#!/usr/bin/python3
#
# This file is part of MagiskOnWSALocal.
#
# MagiskOnWSALocal is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# MagiskOnWSALocal is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with MagiskOnWSALocal. If not, see <https://www.gnu.org/licenses/>.
#
# Copyright (C) 2023 LSPosed Contributors
#
import sys
import zipfile
from pathlib import Path
arch = sys.argv[1]
zip_name = ""
wsa_zip_path= Path(sys.argv[2]).resolve()
with zipfile.ZipFile(wsa_zip_path) as zip:
for f in zip.filelist:
if arch in f.filename.lower():
zip_name = f.filename
ver_no = zip_name.split("_")
long_ver = ver_no[1]
ver = long_ver.split(".")
main_ver = ver[0]
print(main_ver)