mirror of
https://github.com/MustardChef/WSABuilds.git
synced 2024-11-14 07:35:07 +01:00
Download GApps by Android version (#280)
This commit is contained in:
parent
78a408de0c
commit
c9e4374c2f
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,3 +1,4 @@
|
||||
*.py text eol=lf
|
||||
*.sh text eol=lf
|
||||
*.exe binary
|
||||
*.apk binary
|
||||
|
@ -42,6 +42,10 @@ SUDO="$(which sudo 2>/dev/null)"
|
||||
if [ -z "$SUDO" ]; then
|
||||
unset SUDO
|
||||
fi
|
||||
WSA_WORK_ENV="${WORK_DIR:?}"/ENV
|
||||
if [ -f "$WSA_WORK_ENV" ]; then rm -f "${WSA_WORK_ENV:?}"; fi
|
||||
touch "$WSA_WORK_ENV"
|
||||
export WSA_WORK_ENV
|
||||
umount_clean() {
|
||||
if [ -d "$MOUNT_DIR" ]; then
|
||||
echo "Cleanup Work Directory"
|
||||
@ -88,7 +92,7 @@ abort() {
|
||||
}
|
||||
trap abort INT TERM
|
||||
|
||||
function Gen_Rand_Str {
|
||||
Gen_Rand_Str() {
|
||||
tr -dc 'a-zA-Z0-9' </dev/urandom | fold -w "$1" | head -n 1
|
||||
}
|
||||
|
||||
@ -324,6 +328,7 @@ require_su() {
|
||||
}
|
||||
|
||||
declare -A RELEASE_NAME_MAP=(["retail"]="Retail" ["RP"]="Release Preview" ["WIS"]="Insider Slow" ["WIF"]="Insider Fast")
|
||||
declare -A ANDROID_API_MAP=(["30"]="11.0" ["32"]="12.1" ["33"]="13.0")
|
||||
RELEASE_NAME=${RELEASE_NAME_MAP[$RELEASE_TYPE]} || abort
|
||||
|
||||
echo -e "Build: RELEASE_TYPE=$RELEASE_NAME"
|
||||
@ -345,22 +350,33 @@ if [ "$CUSTOM_MAGISK" ]; then
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
ANDROID_API=32
|
||||
update_gapps_zip_name() {
|
||||
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
|
||||
GAPPS_PATH="$DOWNLOAD_DIR"/OpenGApps-$ARCH-$GAPPS_VARIANT.zip
|
||||
ANDROID_API=30
|
||||
GAPPS_ZIP_NAME="$GAPPS_BRAND-$ARCH-${ANDROID_API_MAP[$ANDROID_API]}-$GAPPS_VARIANT".zip
|
||||
else
|
||||
GAPPS_PATH="$DOWNLOAD_DIR"/MindTheGapps-"$ARCH".zip
|
||||
GAPPS_ZIP_NAME="$GAPPS_BRAND-$ARCH-${ANDROID_API_MAP[$ANDROID_API]}".zip
|
||||
fi
|
||||
|
||||
GAPPS_PATH=$DOWNLOAD_DIR/$GAPPS_ZIP_NAME
|
||||
}
|
||||
update_gapps_zip_name
|
||||
if [ -z "${OFFLINE+x}" ]; then
|
||||
trap 'rm -f -- "${DOWNLOAD_DIR:?}/${DOWNLOAD_CONF_NAME}"' EXIT
|
||||
require_su
|
||||
echo "Generate Download Links"
|
||||
python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
||||
# shellcheck disable=SC1091
|
||||
source "${WORK_DIR:?}/ENV" || abort
|
||||
if [[ "$DOWN_WSA_MAIN_VERSION" -ge 2211 ]]; then
|
||||
ANDROID_API=33
|
||||
update_gapps_zip_name
|
||||
fi
|
||||
if [ -z "${CUSTOM_MAGISK+x}" ]; then
|
||||
python3 generateMagiskLink.py "$MAGISK_VER" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
||||
fi
|
||||
if [ "$GAPPS_BRAND" != "none" ]; then
|
||||
python3 generateGappsLink.py "$ARCH" "$GAPPS_BRAND" "$GAPPS_VARIANT" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
|
||||
python3 generateGappsLink.py "$ARCH" "$GAPPS_BRAND" "$GAPPS_VARIANT" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" "$ANDROID_API" "$GAPPS_ZIP_NAME" || abort
|
||||
fi
|
||||
|
||||
echo "Download Artifacts"
|
||||
@ -391,10 +407,6 @@ fi
|
||||
|
||||
echo "Extract WSA"
|
||||
if [ -f "$WSA_ZIP_PATH" ]; then
|
||||
WSA_WORK_ENV="${WORK_DIR:?}"/ENV
|
||||
if [ -f "$WSA_WORK_ENV" ]; then rm -f "${WSA_WORK_ENV:?}"; fi
|
||||
touch "$WSA_WORK_ENV"
|
||||
export WSA_WORK_ENV
|
||||
if ! python3 extractWSA.py "$ARCH" "$WSA_ZIP_PATH" "$WORK_DIR"; then
|
||||
echo "Unzip WSA failed, is the download incomplete?"
|
||||
CLEAN_DOWNLOAD_WSA=1
|
||||
@ -403,6 +415,10 @@ if [ -f "$WSA_ZIP_PATH" ]; then
|
||||
echo -e "Extract done\n"
|
||||
# shellcheck disable=SC1091
|
||||
source "${WORK_DIR:?}/ENV" || abort
|
||||
if [[ "$WSA_MAIN_VER" -ge 2211 ]]; then
|
||||
ANDROID_API=33
|
||||
update_gapps_zip_name
|
||||
fi
|
||||
else
|
||||
echo "The WSA zip package does not exist, is the download incomplete?"
|
||||
exit 1
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# This file is part of MagiskOnWSALocal.
|
||||
#
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# This file is part of MagiskOnWSALocal.
|
||||
#
|
||||
@ -47,14 +47,12 @@ with zipfile.ZipFile(wsa_zip_path) as zip:
|
||||
long_ver = ver_no[1]
|
||||
ver = long_ver.split(".")
|
||||
main_ver = ver[0]
|
||||
with open(os.environ['WSA_WORK_ENV'], 'a') as g:
|
||||
g.write(f'WSA_VER={long_ver}\n')
|
||||
with open(os.environ['WSA_WORK_ENV'], 'a') as g:
|
||||
g.write(f'WSA_MAIN_VER={main_ver}\n')
|
||||
rel = ver_no[3].split(".")
|
||||
rell = str(rel[0])
|
||||
with open(os.environ['WSA_WORK_ENV'], 'a') as g:
|
||||
g.write(f'WSA_REL={rell}\n')
|
||||
rel_long = str(rel[0])
|
||||
with open(os.environ['WSA_WORK_ENV'], 'a') as environ_file:
|
||||
environ_file.write(f'WSA_VER={long_ver}\n')
|
||||
environ_file.write(f'WSA_MAIN_VER={main_ver}\n')
|
||||
environ_file.write(f'WSA_REL={rel_long}\n')
|
||||
if 'language' in f.filename.lower() or 'scale' in f.filename.lower():
|
||||
name = f.filename.split("-", 1)[1].split(".")[0]
|
||||
zip.extract(f, workdir)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# This file is part of MagiskOnWSALocal.
|
||||
#
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# This file is part of MagiskOnWSALocal.
|
||||
#
|
||||
@ -31,13 +31,13 @@ variant = sys.argv[3]
|
||||
download_dir = Path.cwd().parent / \
|
||||
"download" if sys.argv[4] == "" else Path(sys.argv[4]).resolve()
|
||||
tempScript = sys.argv[5]
|
||||
android_api = sys.argv[6]
|
||||
file_name = sys.argv[7]
|
||||
print(
|
||||
f"Generating {brand} download link: arch={arch} variant={variant}", flush=True)
|
||||
abi_map = {"x64": "x86_64", "arm64": "arm64"}
|
||||
# TODO: keep it 11.0 since opengapps does not support 12+ yet
|
||||
# As soon as opengapps is available for 12+, we need to get the sdk/release from build.prop and
|
||||
# download the corresponding version
|
||||
release = "11.0"
|
||||
android_api_map = {"30": "11.0", "32": "12.1", "33": "13.0"}
|
||||
release = [android_api_map[android_api]]
|
||||
if brand == "OpenGApps":
|
||||
try:
|
||||
res = requests.get(f"https://api.opengapps.org/list")
|
||||
@ -55,7 +55,7 @@ if brand == "OpenGApps":
|
||||
elif brand == "MindTheGapps":
|
||||
res = requests.get(
|
||||
f'https://sourceforge.net/projects/wsa-mtg/rss?path=/{abi_map[arch]}&limit=100')
|
||||
link = re.search(f'https://.*{abi_map[arch]}/.*\.zip/download', res.text).group().replace(
|
||||
link = re.search(f'https://.*{release}.*{abi_map[arch]}/.*\.zip/download', res.text).group().replace(
|
||||
'.zip/download', '.zip').replace('sourceforge.net/projects/wsa-mtg/files', 'downloads.sourceforge.net/project/wsa-mtg')
|
||||
|
||||
print(f"download link: {link}", flush=True)
|
||||
@ -63,7 +63,4 @@ print(f"download link: {link}", flush=True)
|
||||
with open(download_dir/tempScript, 'a') as f:
|
||||
f.writelines(f'{link}\n')
|
||||
f.writelines(f' dir={download_dir}\n')
|
||||
if brand == "OpenGApps":
|
||||
f.writelines(f' out={brand}-{arch}-{variant}.zip\n')
|
||||
elif brand == "MindTheGapps":
|
||||
f.writelines(f' out={brand}-{arch}.zip\n')
|
||||
f.writelines(f' out={file_name}\n')
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# This file is part of MagiskOnWSALocal.
|
||||
#
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# This file is part of MagiskOnWSALocal.
|
||||
#
|
||||
@ -26,6 +26,7 @@ import html
|
||||
import warnings
|
||||
import re
|
||||
from pathlib import Path
|
||||
import os
|
||||
|
||||
warnings.filterwarnings("ignore")
|
||||
|
||||
@ -91,6 +92,11 @@ for i, v, f in identities:
|
||||
# out_file_name = f"Microsoft.VCLibs.140.00.UWPDesktop_{arch}.appx"
|
||||
# out_file = download_dir / out_file_name
|
||||
elif re.match(f"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", f):
|
||||
wsa_long_ver = re.search(u'\d{4}.\d{5}.\d{1,}.\d{1,}', f).group()
|
||||
main_ver = wsa_long_ver.split(".")[0]
|
||||
with open(os.environ['WSA_WORK_ENV'], 'a') as environ_file:
|
||||
environ_file.write(f"DOWN_WSA_VERSION={wsa_long_ver}\n")
|
||||
environ_file.write(f"DOWN_WSA_MAIN_VERSION={main_ver}\n")
|
||||
out_file_name = f"wsa-{release_type}.zip"
|
||||
out_file = download_dir / out_file_name
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user