mirror of
https://github.com/LSPosed/MagiskOnWSALocal.git
synced 2025-04-22 00:19:08 +00:00
No hard-code kernel version
This commit is contained in:
parent
ea61cd4052
commit
bd7dba0a92
4 changed files with 87 additions and 96 deletions
|
@ -348,36 +348,71 @@ update_gapps_file_name() {
|
||||||
GAPPS_PATH=$DOWNLOAD_DIR/$GAPPS_FILE_NAME
|
GAPPS_PATH=$DOWNLOAD_DIR/$GAPPS_FILE_NAME
|
||||||
}
|
}
|
||||||
WSA_MAJOR_VER=0
|
WSA_MAJOR_VER=0
|
||||||
|
getKernelVersion() {
|
||||||
|
local bintype kernel_string kernel_version
|
||||||
|
bintype="$(file -b "$1")"
|
||||||
|
if [[ $bintype == *"version"* ]]; then
|
||||||
|
readarray -td '' kernel_string < <(awk '{ gsub(/, /,"\0"); print; }' <<<"$bintype, ")
|
||||||
|
unset 'kernel_string[-1]'
|
||||||
|
for i in "${kernel_string[@]}"; do
|
||||||
|
if [[ $i == *"version"* ]]; then
|
||||||
|
IFS=" " read -r -a kernel_string <<<"$i"
|
||||||
|
kernel_version="${kernel_string[1]}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
IFS=" " read -r -a kernel_string <<<"$(strings "$1" | grep 'Linux version')"
|
||||||
|
kernel_version="${kernel_string[2]}"
|
||||||
|
fi
|
||||||
|
IFS=" " read -r -a arr <<<"${kernel_version//-/ }"
|
||||||
|
printf '%s' "${arr[0]}"
|
||||||
|
}
|
||||||
update_ksu_zip_name() {
|
update_ksu_zip_name() {
|
||||||
KERNEL_VER=""
|
KERNEL_VER=""
|
||||||
case "$WSA_MAJOR_VER" in
|
if [ -f "$WORK_DIR/wsa/$ARCH/Tools/kernel" ]; then
|
||||||
"2305") KERNEL_VER="5.15.94.2" ;;
|
KERNEL_VER=$(getKernelVersion "$WORK_DIR/wsa/$ARCH/Tools/kernel")
|
||||||
"2306") KERNEL_VER="5.15.104.1" ;;
|
fi
|
||||||
"2307") KERNEL_VER="5.15.104.2" ;;
|
|
||||||
"2308") KERNEL_VER="5.15.104.3" ;;
|
|
||||||
"2309") KERNEL_VER="5.15.104.4" ;;
|
|
||||||
*) abort "KernelSU is not supported in this WSA version: $WSA_MAJOR_VER" ;;
|
|
||||||
esac
|
|
||||||
KERNELSU_ZIP_NAME=kernelsu-$ARCH-$KERNEL_VER.zip
|
KERNELSU_ZIP_NAME=kernelsu-$ARCH-$KERNEL_VER.zip
|
||||||
KERNELSU_PATH=$DOWNLOAD_DIR/$KERNELSU_ZIP_NAME
|
KERNELSU_PATH=$DOWNLOAD_DIR/$KERNELSU_ZIP_NAME
|
||||||
KERNELSU_INFO="$KERNELSU_PATH.info"
|
KERNELSU_INFO="$KERNELSU_PATH.info"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z ${OFFLINE+x} ]; then
|
if [ -z ${OFFLINE+x} ]; then
|
||||||
|
echo "Generating WSA Download Links"
|
||||||
require_su
|
require_su
|
||||||
if [ "$DOWN_WSA" != "no" ]; then
|
if [ "$DOWN_WSA" != "no" ]; then
|
||||||
echo "Generate Download Links"
|
|
||||||
python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
||||||
# shellcheck disable=SC1090
|
echo "Downloading WSA"
|
||||||
source "$WSA_WORK_ENV" || abort
|
|
||||||
else
|
else
|
||||||
echo "Generate Download Links"
|
|
||||||
python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" "$DOWN_WSA" || abort
|
python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" "$DOWN_WSA" || abort
|
||||||
WSA_MAJOR_VER=$(python3 getWSAMajorVersion.py "$ARCH" "$WSA_ZIP_PATH")
|
echo "Skip download WSA, downloading WSA depends"
|
||||||
fi
|
fi
|
||||||
if [[ "$WSA_MAJOR_VER" -lt 2211 ]]; then
|
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity=true --continue=true --allow-overwrite=true --conditional-get=true -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR/$DOWNLOAD_CONF_NAME"; then
|
||||||
ANDROID_API=32
|
echo "We have encountered an error while downloading files."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$ROOT_SOL" = "magisk" ]; then
|
rm -f "${DOWNLOAD_DIR:?}/$DOWNLOAD_CONF_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Extract WSA"
|
||||||
|
if [ -f "$WSA_ZIP_PATH" ]; then
|
||||||
|
if ! python3 extractWSA.py "$ARCH" "$WSA_ZIP_PATH" "$WORK_DIR" "$WSA_WORK_ENV"; then
|
||||||
|
CLEAN_DOWNLOAD_WSA=1
|
||||||
|
abort "Unzip WSA failed, is the download incomplete?"
|
||||||
|
fi
|
||||||
|
echo -e "Extract done\n"
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "$WSA_WORK_ENV" || abort
|
||||||
|
else
|
||||||
|
echo "The WSA zip package does not exist, is the download incomplete?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ "$WSA_MAJOR_VER" -lt 2211 ]]; then
|
||||||
|
ANDROID_API=32
|
||||||
|
fi
|
||||||
|
if [ -z ${OFFLINE+x} ]; then
|
||||||
|
echo "Generating Download Links"
|
||||||
|
if [ "$HAS_GAPPS" ] || [ "$ROOT_SOL" = "magisk" ]; then
|
||||||
if [ -z ${CUSTOM_MAGISK+x} ]; then
|
if [ -z ${CUSTOM_MAGISK+x} ]; then
|
||||||
python3 generateMagiskLink.py "$MAGISK_VER" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
python3 generateMagiskLink.py "$MAGISK_VER" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
||||||
fi
|
fi
|
||||||
|
@ -395,18 +430,14 @@ if [ -z ${OFFLINE+x} ]; then
|
||||||
python3 generateGappsLink.py "$ARCH" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" "$ANDROID_API" "$GAPPS_FILE_NAME" || abort
|
python3 generateGappsLink.py "$ARCH" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" "$ANDROID_API" "$GAPPS_FILE_NAME" || abort
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Download Artifacts"
|
echo "Downloading Artifacts"
|
||||||
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity=true --continue=true --allow-overwrite=true --conditional-get=true -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR/$DOWNLOAD_CONF_NAME"; then
|
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity=true --continue=true --allow-overwrite=true --conditional-get=true -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR/$DOWNLOAD_CONF_NAME"; then
|
||||||
echo "We have encountered an error while downloading files."
|
echo "We have encountered an error while downloading files."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else # Offline mode
|
else # Offline mode
|
||||||
WSA_MAJOR_VER=$(python3 getWSAMajorVersion.py "$ARCH" "$WSA_ZIP_PATH")
|
declare -A FILES_CHECK_LIST=([xaml_PATH]="$xaml_PATH" [vclibs_PATH]="$vclibs_PATH" [UWPVCLibs_PATH]="$UWPVCLibs_PATH")
|
||||||
if [[ "$WSA_MAJOR_VER" -lt 2211 ]]; then
|
if [ "$HAS_GAPPS" ] || [ "$ROOT_SOL" = "magisk" ]; then
|
||||||
ANDROID_API=32
|
|
||||||
fi
|
|
||||||
declare -A FILES_CHECK_LIST=([WSA_ZIP_PATH]="$WSA_ZIP_PATH" [xaml_PATH]="$xaml_PATH" [vclibs_PATH]="$vclibs_PATH" [UWPVCLibs_PATH]="$UWPVCLibs_PATH")
|
|
||||||
if [ "$ROOT_SOL" = "magisk" ]; then
|
|
||||||
FILES_CHECK_LIST+=(["MAGISK_PATH"]="$MAGISK_PATH")
|
FILES_CHECK_LIST+=(["MAGISK_PATH"]="$MAGISK_PATH")
|
||||||
fi
|
fi
|
||||||
if [ "$ROOT_SOL" = "kernelsu" ]; then
|
if [ "$ROOT_SOL" = "kernelsu" ]; then
|
||||||
|
@ -430,20 +461,6 @@ else # Offline mode
|
||||||
require_su
|
require_su
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Extract WSA"
|
|
||||||
if [ -f "$WSA_ZIP_PATH" ]; then
|
|
||||||
if ! python3 extractWSA.py "$ARCH" "$WSA_ZIP_PATH" "$WORK_DIR" "$WSA_WORK_ENV"; then
|
|
||||||
CLEAN_DOWNLOAD_WSA=1
|
|
||||||
abort "Unzip WSA failed, is the download incomplete?"
|
|
||||||
fi
|
|
||||||
echo -e "Extract done\n"
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "$WSA_WORK_ENV" || abort
|
|
||||||
else
|
|
||||||
echo "The WSA zip package does not exist, is the download incomplete?"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$HAS_GAPPS" ] || [ "$ROOT_SOL" = "magisk" ]; then
|
if [ "$HAS_GAPPS" ] || [ "$ROOT_SOL" = "magisk" ]; then
|
||||||
echo "Extract Magisk"
|
echo "Extract Magisk"
|
||||||
if [ -f "$MAGISK_PATH" ]; then
|
if [ -f "$MAGISK_PATH" ]; then
|
||||||
|
@ -479,10 +496,11 @@ if [ "$ROOT_SOL" = "magisk" ]; then
|
||||||
"$WORK_DIR/magisk/magiskboot" cpio "$WORK_DIR/wsa/$ARCH/Tools/initrd.img" "mv /init /wsainit" "add 0750 /lspinit ../bin/$ARCH/lspinit" "ln /lspinit /init" "add 0750 /magiskinit $WORK_DIR/magisk/magiskinit" "mkdir 0750 overlay.d" "mkdir 0750 overlay.d/sbin" "add 0644 overlay.d/sbin/magisk64.xz $WORK_DIR/magisk/magisk64.xz" "add 0644 overlay.d/sbin/magisk32.xz $WORK_DIR/magisk/magisk32.xz" "add 0644 overlay.d/sbin/stub.xz $WORK_DIR/magisk/stub.xz" "mkdir 000 .backup" "add 000 .backup/.magisk $WORK_DIR/magisk/config" || abort "Unable to patch initrd"
|
"$WORK_DIR/magisk/magiskboot" cpio "$WORK_DIR/wsa/$ARCH/Tools/initrd.img" "mv /init /wsainit" "add 0750 /lspinit ../bin/$ARCH/lspinit" "ln /lspinit /init" "add 0750 /magiskinit $WORK_DIR/magisk/magiskinit" "mkdir 0750 overlay.d" "mkdir 0750 overlay.d/sbin" "add 0644 overlay.d/sbin/magisk64.xz $WORK_DIR/magisk/magisk64.xz" "add 0644 overlay.d/sbin/magisk32.xz $WORK_DIR/magisk/magisk32.xz" "add 0644 overlay.d/sbin/stub.xz $WORK_DIR/magisk/stub.xz" "mkdir 000 .backup" "add 000 .backup/.magisk $WORK_DIR/magisk/config" || abort "Unable to patch initrd"
|
||||||
echo -e "Integrate Magisk done\n"
|
echo -e "Integrate Magisk done\n"
|
||||||
elif [ "$ROOT_SOL" = "kernelsu" ]; then
|
elif [ "$ROOT_SOL" = "kernelsu" ]; then
|
||||||
update_ksu_zip_name
|
|
||||||
echo "Extract KernelSU"
|
echo "Extract KernelSU"
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "${KERNELSU_INFO:?}" || abort
|
source "${KERNELSU_INFO:?}" || abort
|
||||||
|
echo "WSA Kernel Version: $KERNEL_VER"
|
||||||
|
echo "KernelSU Version: $KERNELSU_VER"
|
||||||
if ! unzip "$KERNELSU_PATH" -d "$WORK_DIR/kernelsu"; then
|
if ! unzip "$KERNELSU_PATH" -d "$WORK_DIR/kernelsu"; then
|
||||||
CLEAN_DOWNLOAD_KERNELSU=1
|
CLEAN_DOWNLOAD_KERNELSU=1
|
||||||
abort "Unzip KernelSU failed, package is corrupted?"
|
abort "Unzip KernelSU failed, package is corrupted?"
|
||||||
|
|
|
@ -27,6 +27,7 @@ import requests
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from packaging import version
|
||||||
|
|
||||||
|
|
||||||
class Prop(OrderedDict):
|
class Prop(OrderedDict):
|
||||||
|
@ -53,20 +54,34 @@ tempScript = sys.argv[3]
|
||||||
kernelVersion = sys.argv[4]
|
kernelVersion = sys.argv[4]
|
||||||
file_name = sys.argv[5]
|
file_name = sys.argv[5]
|
||||||
abi_map = {"x64": "x86_64", "arm64": "arm64"}
|
abi_map = {"x64": "x86_64", "arm64": "arm64"}
|
||||||
print(f"Generating KernelSU download link: arch={abi_map[arch]}, kernel version={kernelVersion}", flush=True)
|
print(
|
||||||
res = requests.get(f"https://api.github.com/repos/tiann/KernelSU/releases/latest")
|
f"Generating KernelSU download link: arch={abi_map[arch]}, kernel version={kernelVersion}", flush=True)
|
||||||
|
res = requests.get(
|
||||||
|
f"https://api.github.com/repos/tiann/KernelSU/releases/latest")
|
||||||
json_data = json.loads(res.content)
|
json_data = json.loads(res.content)
|
||||||
headers = res.headers
|
headers = res.headers
|
||||||
x_ratelimit_remaining = headers["x-ratelimit-remaining"]
|
x_ratelimit_remaining = headers["x-ratelimit-remaining"]
|
||||||
|
kernel_ver = 0
|
||||||
if res.status_code == 200:
|
if res.status_code == 200:
|
||||||
link = ""
|
link = ""
|
||||||
assets = json_data["assets"]
|
assets = json_data["assets"]
|
||||||
for asset in assets:
|
for asset in assets:
|
||||||
if re.match(f'kernel-WSA-{abi_map[arch]}-{kernelVersion}.*\.zip$', asset["name"]) and asset["content_type"] == "application/zip":
|
asset_name = asset["name"]
|
||||||
|
if re.match(f'kernel-WSA-{abi_map[arch]}-{kernelVersion}.*\.zip$', asset_name) and asset["content_type"] == "application/zip":
|
||||||
|
tmp_kernel_ver = re.search(
|
||||||
|
u'\d{1}.\d{1,}.\d{1,}.\d{1,}', asset_name.split("-")[3]).group()
|
||||||
|
if (kernel_ver == 0):
|
||||||
|
kernel_ver = tmp_kernel_ver
|
||||||
|
elif version.parse(kernel_ver) < version.parse(tmp_kernel_ver):
|
||||||
|
kernel_ver = tmp_kernel_ver
|
||||||
|
print(f"Kernel version: {kernel_ver}", flush=True)
|
||||||
|
for asset in assets:
|
||||||
|
if re.match(f'kernel-WSA-{abi_map[arch]}-{kernel_ver}.*\.zip$', asset["name"]) and asset["content_type"] == "application/zip":
|
||||||
link = asset["browser_download_url"]
|
link = asset["browser_download_url"]
|
||||||
break
|
break
|
||||||
if link == "":
|
if link == "":
|
||||||
print(f"Error: No KernelSU release found for arch={abi_map[arch]}, kernel version={kernelVersion}", flush=True)
|
print(
|
||||||
|
f"Error: No KernelSU release found for arch={abi_map[arch]}, kernel version={kernelVersion}", flush=True)
|
||||||
exit(1)
|
exit(1)
|
||||||
release_name = json_data["name"]
|
release_name = json_data["name"]
|
||||||
with open(os.environ['WSA_WORK_ENV'], 'r') as environ_file:
|
with open(os.environ['WSA_WORK_ENV'], 'r') as environ_file:
|
||||||
|
@ -79,7 +94,8 @@ elif res.status_code == 403 and x_ratelimit_remaining == '0':
|
||||||
print(f"Github API Error: {message}", flush=True)
|
print(f"Github API Error: {message}", flush=True)
|
||||||
ratelimit_reset = headers["x-ratelimit-reset"]
|
ratelimit_reset = headers["x-ratelimit-reset"]
|
||||||
ratelimit_reset = datetime.fromtimestamp(int(ratelimit_reset))
|
ratelimit_reset = datetime.fromtimestamp(int(ratelimit_reset))
|
||||||
print(f"The current rate limit window resets in {ratelimit_reset}", flush=True)
|
print(
|
||||||
|
f"The current rate limit window resets in {ratelimit_reset}", flush=True)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
print(f"download link: {link}", flush=True)
|
print(f"download link: {link}", flush=True)
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
import html
|
import html
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -70,7 +69,8 @@ if ms_account_conf.is_file():
|
||||||
with open(ms_account_conf, "r") as f:
|
with open(ms_account_conf, "r") as f:
|
||||||
conf = Prop(f.read())
|
conf = Prop(f.read())
|
||||||
user = conf.get('user_code')
|
user = conf.get('user_code')
|
||||||
print(f"Generating WSA download link: arch={arch} release_type={release_name}\n", flush=True)
|
print(
|
||||||
|
f"Generating WSA download link: arch={arch} release_type={release_name}\n", flush=True)
|
||||||
with open(Path.cwd().parent / ("xml/GetCookie.xml"), "r") as f:
|
with open(Path.cwd().parent / ("xml/GetCookie.xml"), "r") as f:
|
||||||
cookie_content = f.read().format(user)
|
cookie_content = f.read().format(user)
|
||||||
|
|
||||||
|
@ -146,8 +146,9 @@ threads = []
|
||||||
wsa_build_ver = 0
|
wsa_build_ver = 0
|
||||||
for filename, values in identities.items():
|
for filename, values in identities.items():
|
||||||
if re.match(f"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename):
|
if re.match(f"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename):
|
||||||
tmp_wsa_build_ver = re.search(u'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group()
|
tmp_wsa_build_ver = re.search(
|
||||||
if(wsa_build_ver == 0):
|
u'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group()
|
||||||
|
if (wsa_build_ver == 0):
|
||||||
wsa_build_ver = tmp_wsa_build_ver
|
wsa_build_ver = tmp_wsa_build_ver
|
||||||
elif version.parse(wsa_build_ver) < version.parse(tmp_wsa_build_ver):
|
elif version.parse(wsa_build_ver) < version.parse(tmp_wsa_build_ver):
|
||||||
wsa_build_ver = tmp_wsa_build_ver
|
wsa_build_ver = tmp_wsa_build_ver
|
||||||
|
@ -162,25 +163,21 @@ for filename, values in identities.items():
|
||||||
out_file_name = f"{values[1]}_{arch}.appx"
|
out_file_name = f"{values[1]}_{arch}.appx"
|
||||||
out_file = download_dir / out_file_name
|
out_file = download_dir / out_file_name
|
||||||
elif not skip_wsa_download and re.match(f"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename):
|
elif not skip_wsa_download and re.match(f"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename):
|
||||||
tmp_wsa_build_ver = re.search(u'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group()
|
tmp_wsa_build_ver = re.search(
|
||||||
if(wsa_build_ver != tmp_wsa_build_ver):
|
u'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group()
|
||||||
|
if (wsa_build_ver != tmp_wsa_build_ver):
|
||||||
continue
|
continue
|
||||||
version_splitted = wsa_build_ver.split(".")
|
version_splitted = wsa_build_ver.split(".")
|
||||||
major_ver = version_splitted[0]
|
major_ver = version_splitted[0]
|
||||||
minor_ver = version_splitted[1]
|
minor_ver = version_splitted[1]
|
||||||
build_ver = version_splitted[2]
|
build_ver = version_splitted[2]
|
||||||
revision_ver = version_splitted[3]
|
revision_ver = version_splitted[3]
|
||||||
with open(os.environ['WSA_WORK_ENV'], 'r') as environ_file:
|
|
||||||
env = Prop(environ_file.read())
|
|
||||||
env.WSA_VER = wsa_build_ver
|
|
||||||
env.WSA_MAJOR_VER = major_ver
|
|
||||||
with open(os.environ['WSA_WORK_ENV'], 'w') as environ_file:
|
|
||||||
environ_file.write(str(env))
|
|
||||||
out_file_name = f"wsa-{release_type}.zip"
|
out_file_name = f"wsa-{release_type}.zip"
|
||||||
out_file = download_dir / out_file_name
|
out_file = download_dir / out_file_name
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
th = Thread(target=send_req, args=(values[0][0], values[0][1], out_file_name))
|
th = Thread(target=send_req, args=(
|
||||||
|
values[0][0], values[0][1], out_file_name))
|
||||||
threads.append(th)
|
threads.append(th)
|
||||||
th.daemon = True
|
th.daemon = True
|
||||||
th.start()
|
th.start()
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
#!/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])
|
|
||||||
|
|
||||||
with zipfile.ZipFile(wsa_zip_path) as zip:
|
|
||||||
for f in zip.filelist:
|
|
||||||
if arch in f.filename.lower():
|
|
||||||
zip_name = f.filename
|
|
||||||
break
|
|
||||||
ver_no = zip_name.split("_")
|
|
||||||
long_ver = ver_no[1]
|
|
||||||
ver = long_ver.split(".")
|
|
||||||
major_ver = ver[0]
|
|
||||||
print(major_ver)
|
|
Loading…
Add table
Reference in a new issue