This commit is contained in:
Peter Njeim 2022-12-09 19:18:19 -04:00
commit 91bdc6819c
13 changed files with 156 additions and 102 deletions

1
.gitattributes vendored
View File

@ -1,3 +1,4 @@
*.py text eol=lf
*.sh text eol=lf
*.exe binary
*.apk binary

View File

@ -62,6 +62,11 @@ on:
# required: true
# default: false
# type: boolean
# skip_download_wsa:
# description: Skip WSA Download
# required: true
# default: false
# type: boolean
compression:
description: "Compression Algorithm"
required: true
@ -104,7 +109,7 @@ jobs:
DOWNLOAD_DIR=../download
DOWNLOAD_CONF_NAME=download.list
declare -A opts=( ["ARCH,x86_64"]="x64" ["ARCH,ARM64"]="arm64" ["RELEASE_TYPE,General Availability Channel"]="retail" ["RELEASE_TYPE,Release Preview Channel"]="RP" ["RELEASE_TYPE,Beta Channel"]="WIS" ["RELEASE_TYPE,Dev Channel"]="WIF" ["MAGISK_VER,Stable"]="stable" ["MAGISK_VER,Beta"]="beta" ["MAGISK_VER,Canary"]="canary" ["MAGISK_VER,Debug"]="debug" ["MAGISK_VER,Custom"]="--magisk-custom" ["GAPPS_VAR,None"]="none" ["GAPPS_VAR,Pico"]="pico" ["GAPPS_VAR,Full"]="full" ["REMOVE_AMAZON,true"]="--remove-amazon" ["NOFIX_PROPS,true"]="--nofix-props" ["COMPRESSION,ZIP"]="zip" ["COMPRESSION,7-Zip"]="7z" ["COMPRESSION,XZ"]="xz" )
declare -A opts=( ["ARCH,x86_64"]="x64" ["ARCH,ARM64"]="arm64" ["RELEASE_TYPE,General Availability Channel"]="retail" ["RELEASE_TYPE,Release Preview Channel"]="RP" ["RELEASE_TYPE,Beta Channel"]="WIS" ["RELEASE_TYPE,Dev Channel"]="WIF" ["MAGISK_VER,Stable"]="stable" ["MAGISK_VER,Beta"]="beta" ["MAGISK_VER,Canary"]="canary" ["MAGISK_VER,Debug"]="debug" ["MAGISK_VER,Custom"]="--magisk-custom" ["GAPPS_VAR,None"]="none" ["GAPPS_VAR,Pico"]="pico" ["GAPPS_VAR,Full"]="full" ["REMOVE_AMAZON,true"]="--remove-amazon" ["NOFIX_PROPS,true"]="--nofix-props" ["SKIP_DOWNLOAD_WSA,true"]="--skip-download-wsa" ["COMPRESSION,ZIP"]="zip" ["COMPRESSION,7-Zip"]="7z" ["COMPRESSION,XZ"]="xz" )
ARCH="${opts[ARCH,${{ inputs.arch }}]}"
@ -215,6 +220,8 @@ jobs:
NOFIX_PROPS="${opts[NOFIX_PROPS,${{ inputs.nofix_props }}]}"
SKIP_DOWNLOAD_WSA="${opts[SKIP_DOWNLOAD_WSA,${{ inputs.skip_download_wsa }}]}"
COMPRESSION="--compress --compress-format ${opts[COMPRESSION,${{ inputs.compression }}]}"
if [[ "${{ inputs.gapps_var }}" == "Custom"* ]]; then
@ -232,7 +239,7 @@ jobs:
OFFLINE="--offline"
fi
COMMAND_LINE=(--arch "$ARCH" --release-type "$RELEASE_TYPE" --root-sol "$ROOT_SOL" --magisk-ver "$MAGISK_VER" "$CUSTOM_MAGISK" --gapps-brand "$GAPPS_BRAND" --gapps-variant "$GAPPS_VAR" "$COMPRESSION" "$REMOVE_AMAZON" "$NOFIX_PROPS" "$OFFLINE")
COMMAND_LINE=(--arch "$ARCH" --release-type "$RELEASE_TYPE" --root-sol "$ROOT_SOL" --magisk-ver "$MAGISK_VER" "$CUSTOM_MAGISK" --gapps-brand "$GAPPS_BRAND" --gapps-variant "$GAPPS_VAR" "$COMPRESSION" "$REMOVE_AMAZON" "$NOFIX_PROPS" "$SKIP_DOWNLOAD_WSA" "$OFFLINE")
echo "COMMAND_LINE=${COMMAND_LINE[*]}"
chmod +x ./build.sh
@ -247,7 +254,7 @@ jobs:
elif [[ "${{ inputs.magisk_ver }}" == "Custom" ]]; then
magiskVer="_Magisk-Custom"
else
magiskVer="_Magisk-$(curl -s https://raw.githubusercontent.com/topjohnwu/magisk-files/master/${magisk_vers[${{ inputs.magisk_ver }}]}.json | jq -r ".magisk.version")"
magiskVer="_Magisk-${{ env.MAGISK_VERSION }}"
fi
export magiskVer

View File

@ -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() {
head /dev/urandom | tr -dc A-Za-z0-9 | head -c"$1"
}
@ -169,56 +173,57 @@ usage() {
default
echo -e "
Usage:
--arch Architecture of WSA.
--arch Architecture of WSA.
Possible values: $(ARR_TO_STR "${ARCH_MAP[@]}")
Default: $ARCH
Possible values: $(ARR_TO_STR "${ARCH_MAP[@]}")
Default: $ARCH
--release-type Release type of WSA.
RP means Release Preview, WIS means Insider Slow, WIF means Insider Fast.
--release-type Release type of WSA.
RP means Release Preview, WIS means Insider Slow, WIF means Insider Fast.
Possible values: $(ARR_TO_STR "${RELEASE_TYPE_MAP[@]}")
Default: $RELEASE_TYPE
Possible values: $(ARR_TO_STR "${RELEASE_TYPE_MAP[@]}")
Default: $RELEASE_TYPE
--magisk-ver Magisk version.
--magisk-ver Magisk version.
Possible values: $(ARR_TO_STR "${MAGISK_VER_MAP[@]}")
Default: $MAGISK_VER
Possible values: $(ARR_TO_STR "${MAGISK_VER_MAP[@]}")
Default: $MAGISK_VER
--gapps-brand GApps brand.
\"none\" for no integration of GApps
--gapps-brand GApps brand.
\"none\" for no integration of GApps
Possible values: $(ARR_TO_STR "${GAPPS_BRAND_MAP[@]}")
Default: $GAPPS_BRAND
Possible values: $(ARR_TO_STR "${GAPPS_BRAND_MAP[@]}")
Default: $GAPPS_BRAND
--gapps-variant GApps variant.
--gapps-variant GApps variant.
Possible values: $(ARR_TO_STR "${GAPPS_VARIANT_MAP[@]}")
Default: $GAPPS_VARIANT
Possible values: $(ARR_TO_STR "${GAPPS_VARIANT_MAP[@]}")
Default: $GAPPS_VARIANT
--root-sol Root solution.
\"none\" means no root.
--root-sol Root solution.
\"none\" means no root.
Possible values: $(ARR_TO_STR "${ROOT_SOL_MAP[@]}")
Default: $ROOT_SOL
Possible values: $(ARR_TO_STR "${ROOT_SOL_MAP[@]}")
Default: $ROOT_SOL
--compress-format
Compress format of output file.
If this option is not specified and --compress is not specified, the generated file will not be compressed
Compress format of output file.
If this option is not specified and --compress is not specified, the generated file will not be compressed
Possible values: $(ARR_TO_STR "${COMPRESS_FORMAT_MAP[@]}")
Possible values: $(ARR_TO_STR "${COMPRESS_FORMAT_MAP[@]}")
Additional Options:
--remove-amazon Remove Amazon Appstore from the system
--compress Compress the WSA, The default format is 7z, you can use the format specified by --compress-format
--offline Build WSA offline
--magisk-custom Install custom Magisk
--debug Debug build mode
--help Show this help message and exit
--nofix-props No fix \"build.prop\"
$GAPPS_PROPS_MSG1
$GAPPS_PROPS_MSG2
$GAPPS_PROPS_MSG3
--remove-amazon Remove Amazon Appstore from the system
--compress Compress the WSA, The default format is 7z, you can use the format specified by --compress-format
--offline Build WSA offline
--magisk-custom Install custom Magisk
--skip-download-wsa Skip download WSA
--debug Debug build mode
--help Show this help message and exit
--nofix-props No fix \"build.prop\"
$GAPPS_PROPS_MSG1
$GAPPS_PROPS_MSG2
$GAPPS_PROPS_MSG3
Example:
./build.sh --release-type RP --magisk-ver beta --gapps-variant pico --remove-amazon
@ -243,6 +248,7 @@ ARGUMENT_LIST=(
"magisk-custom"
"debug"
"help"
"skip-download-wsa"
)
default
@ -258,21 +264,22 @@ opts=$(
eval set --"$opts"
while [[ $# -gt 0 ]]; do
case "$1" in
--arch ) ARCH="$2"; shift 2 ;;
--release-type ) RELEASE_TYPE="$2"; shift 2 ;;
--gapps-brand ) GAPPS_BRAND="$2"; shift 2 ;;
--gapps-variant ) GAPPS_VARIANT="$2"; shift 2 ;;
--nofix-props ) NOFIX_PROPS="yes"; shift ;;
--root-sol ) ROOT_SOL="$2"; shift 2 ;;
--compress-format ) COMPRESS_FORMAT="$2"; shift 2 ;;
--remove-amazon ) REMOVE_AMAZON="yes"; shift ;;
--compress ) COMPRESS_OUTPUT="yes"; shift ;;
--offline ) OFFLINE="on"; shift ;;
--magisk-custom ) CUSTOM_MAGISK="debug"; shift ;;
--magisk-ver ) MAGISK_VER="$2"; shift 2 ;;
--debug ) DEBUG="on"; shift ;;
--help ) usage; exit 0 ;;
-- ) shift; break;;
--arch ) ARCH="$2"; shift 2 ;;
--release-type ) RELEASE_TYPE="$2"; shift 2 ;;
--gapps-brand ) GAPPS_BRAND="$2"; shift 2 ;;
--gapps-variant ) GAPPS_VARIANT="$2"; shift 2 ;;
--nofix-props ) NOFIX_PROPS="yes"; shift ;;
--root-sol ) ROOT_SOL="$2"; shift 2 ;;
--compress-format ) COMPRESS_FORMAT="$2"; shift 2 ;;
--remove-amazon ) REMOVE_AMAZON="yes"; shift ;;
--compress ) COMPRESS_OUTPUT="yes"; shift ;;
--offline ) OFFLINE="on"; shift ;;
--magisk-custom ) CUSTOM_MAGISK="debug"; shift ;;
--magisk-ver ) MAGISK_VER="$2"; shift 2 ;;
--debug ) DEBUG="on"; shift ;;
--skip-download-wsa ) DOWN_WSA="no"; shift ;;
--help ) usage; exit 0 ;;
-- ) shift; break;;
esac
done
@ -324,6 +331,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 +353,39 @@ if [ "$CUSTOM_MAGISK" ]; then
fi
fi
fi
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
GAPPS_PATH="$DOWNLOAD_DIR"/OpenGApps-$ARCH-$GAPPS_VARIANT.zip
else
GAPPS_PATH="$DOWNLOAD_DIR"/MindTheGapps-"$ARCH".zip
fi
ANDROID_API=32
update_gapps_zip_name() {
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
# TODO: keep it 11.0 since official 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
ANDROID_API=30
GAPPS_ZIP_NAME="$GAPPS_BRAND-$ARCH-${ANDROID_API_MAP[$ANDROID_API]}-$GAPPS_VARIANT".zip
else
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
if [ "${DOWN_WSA}" != "no" ]; then
echo "Generate Download Links"
python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
# shellcheck disable=SC1091
source "${WORK_DIR:?}/ENV" || abort
else
DOWN_WSA_MAIN_VERSION=2211
fi
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 +416,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 +424,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
@ -410,11 +435,15 @@ fi
echo "Extract Magisk"
if [ -f "$MAGISK_PATH" ]; then
version=""
versionCode=0
if ! python3 extractMagisk.py "$ARCH" "$MAGISK_PATH" "$WORK_DIR"; then
echo "Unzip Magisk failed, is the download incomplete?"
CLEAN_DOWNLOAD_MAGISK=1
abort
fi
# shellcheck disable=SC1091
source "${WORK_DIR:?}/ENV" || abort
$SUDO patchelf --replace-needed libc.so "../linker/$HOST_ARCH/libc.so" "$WORK_DIR"/magisk/magiskpolicy || abort
$SUDO patchelf --replace-needed libm.so "../linker/$HOST_ARCH/libm.so" "$WORK_DIR"/magisk/magiskpolicy || abort
$SUDO patchelf --replace-needed libdl.so "../linker/$HOST_ARCH/libdl.so" "$WORK_DIR"/magisk/magiskpolicy || abort
@ -443,6 +472,7 @@ if [ "$GAPPS_BRAND" != 'none' ]; then
else
if ! unzip "$GAPPS_PATH" "system/*" -x "system/addon.d/*" "system/system_ext/priv-app/SetupWizard/*" -d "$WORK_DIR"/gapps; then
echo "Unzip MindTheGapps failed, package is corrupted?"
CLEAN_DOWNLOAD_GAPPS=1
abort
fi
mv "$WORK_DIR"/gapps/system/* "$WORK_DIR"/gapps || abort
@ -507,6 +537,7 @@ echo -e "done\n"
if [ "$REMOVE_AMAZON" ]; then
echo "Remove Amazon Appstore"
find "${MOUNT_DIR:?}"/product/{etc/permissions,etc/sysconfig,framework,priv-app} | grep -e amazon -e venezia | $SUDO xargs rm -rf
find "${MOUNT_DIR:?}"/system_ext/{etc/*permissions,framework,priv-app} | grep -e amazon -e venezia | $SUDO xargs rm -rf
echo -e "done\n"
fi
@ -606,9 +637,9 @@ EOF
fi
echo "Merge Language Resources"
cp "$WORK_DIR"/wsa/"$ARCH"/resources.pri "$WORK_DIR"/wsa/pri/en-us.pri
cp "$WORK_DIR"/wsa/"$ARCH"/AppxManifest.xml "$WORK_DIR"/wsa/xml/en-us.xml
tee "$WORK_DIR"/wsa/priconfig.xml <<EOF
cp "$WORK_DIR"/wsa/"$ARCH"/resources.pri "$WORK_DIR"/wsa/pri/en-us.pri \
&& cp "$WORK_DIR"/wsa/"$ARCH"/AppxManifest.xml "$WORK_DIR"/wsa/xml/en-us.xml && {
tee "$WORK_DIR"/wsa/priconfig.xml <<EOF
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resources targetOsVersion="10.0.0" majorVersion="1">
<index root="\" startIndexAt="\">
@ -617,9 +648,10 @@ tee "$WORK_DIR"/wsa/priconfig.xml <<EOF
</index>
</resources>
EOF
wine64 ../wine/"$HOST_ARCH"/makepri.exe new /pr "$WORK_DIR"/wsa/pri /in MicrosoftCorporationII.WindowsSubsystemForAndroid /cf "$WORK_DIR"/wsa/priconfig.xml /of "$WORK_DIR"/wsa/"$ARCH"/resources.pri /o
sed -i -zE "s/<Resources.*Resources>/<Resources>\n$(cat "$WORK_DIR"/wsa/xml/* | grep -Po '<Resource [^>]*/>' | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/\$/\\$/g' | sed 's/\//\\\//g')\n<\/Resources>/g" "$WORK_DIR"/wsa/"$ARCH"/AppxManifest.xml
echo -e "Merge Language Resources done\n"
wine64 ../wine/"$HOST_ARCH"/makepri.exe new /pr "$WORK_DIR"/wsa/pri /in MicrosoftCorporationII.WindowsSubsystemForAndroid /cf "$WORK_DIR"/wsa/priconfig.xml /of "$WORK_DIR"/wsa/"$ARCH"/resources.pri /o
sed -i -zE "s/<Resources.*Resources>/<Resources>\n$(cat "$WORK_DIR"/wsa/xml/* | grep -Po '<Resource [^>]*/>' | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/\$/\\$/g' | sed 's/\//\\\//g')\n<\/Resources>/g" "$WORK_DIR"/wsa/"$ARCH"/AppxManifest.xml
echo -e "Merge Language Resources done\n"
} || echo -e "Merge Language Resources failed\n"
echo "Add extra packages"
$SUDO cp -r ../"$ARCH"/system/* "$MOUNT_DIR" || abort
@ -854,8 +886,8 @@ echo "Generate info"
if [[ "$ROOT_SOL" = "none" ]]; then
name1=""
elif [[ "$ROOT_SOL" = "" ]]; then
name1="-with-magisk-$MAGISK_VER"
elif [ "$ROOT_SOL" = "" ] || [ "$ROOT_SOL" = "magisk" ]; then
name1="-with-magisk-$version($versionCode)-$MAGISK_VER"
else
name1="-with-$ROOT_SOL-$MAGISK_VER"
fi
@ -863,9 +895,9 @@ if [ "$GAPPS_BRAND" = "none" ]; then
name2="-NoGApps"
else
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
name2="-$GAPPS_BRAND-${GAPPS_VARIANT}"
name2="-$GAPPS_BRAND-${ANDROID_API_MAP[$ANDROID_API]}-${GAPPS_VARIANT}"
else
name2="-$GAPPS_BRAND"
name2="-$GAPPS_BRAND-${ANDROID_API_MAP[$ANDROID_API]}"
fi
if [ "$GAPPS_BRAND" = "OpenGApps" ] && [ "$DEBUG" ]; then
echo ":warning: Since OpenGApps doesn't officially support Android 12.1 yet, lock the variant to pico!"

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
#
# This file is part of MagiskOnWSALocal.
#
@ -23,6 +23,7 @@ import sys
import zipfile
from pathlib import Path
import platform
import os
is_x86_64 = platform.machine() in ("AMD64", "x86_64")
host_abi = "x64" if is_x86_64 else "arm64"
@ -40,6 +41,10 @@ def extract_as(zip, name, as_name, dir):
zip.extract(info, workdir / dir)
with zipfile.ZipFile(magisk_zip) as zip:
comment = zip.comment.decode('utf-8')
with open(os.environ['WSA_WORK_ENV'], 'a') as environ_file:
environ_file.write(f'{comment}\n')
print(f'{comment}', flush=True)
extract_as(
zip, f"lib/{ abi_map[arch][0] }/libmagisk64.so", "magisk64", "magisk")
extract_as(

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
#
# This file is part of MagiskOnWSALocal.
#
@ -47,16 +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['GITHUB_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)

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
#
# This file is part of MagiskOnWSALocal.
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
#
# This file is part of MagiskOnWSALocal.
#
@ -31,9 +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"}
android_api_map = {"30": "11.0", "32": "12.1", "33": "13.0"}
release = android_api_map[android_api]
if brand == "OpenGApps":
# Use Android 12.1 build of OpenGApps (also supports more variants like Full)
if arch == "x64" and variant == "pico":
@ -42,10 +46,6 @@ if brand == "OpenGApps":
link = "http://peternjeim.ddns.net:8081/ipfs/QmULfSMwWuukQR7r9KEvwD2XzsChHTvpswmNqJyEU64jwM"
# Use official Android 11.0 build of OpenGApps (since I didn't build all variants)
else:
# TODO: keep it 11.0 since official 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"
try:
res = requests.get(f"https://api.opengapps.org/list")
j = json.loads(res.content)
@ -63,7 +63,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)
@ -71,7 +71,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')

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
#
# This file is part of MagiskOnWSALocal.
#
@ -18,6 +18,7 @@
# Copyright (C) 2022 LSPosed Contributors
#
import os
import sys
import json
@ -34,10 +35,18 @@ if magisk_ver == "stable" or magisk_ver == "beta" or magisk_ver == "canary" or m
try:
magisk_link = json.loads(requests.get(
f"https://github.com/topjohnwu/magisk-files/raw/master/{magisk_ver}.json").content)['magisk']['link']
magisk_version = json.loads(requests.get(
f"https://github.com/topjohnwu/magisk-files/raw/master/{magisk_ver}.json").content)['magisk']['version']
with open(os.environ['WSA_WORK_ENV'], 'a') as environ_file:
environ_file.write(f'MAGISK_VERSION={magisk_version}\n')
except Exception:
print("Failed to fetch from GitHub API, fallbacking to jsdelivr...")
magisk_link = json.loads(requests.get(
f"https://fastly.jsdelivr.net/gh/topjohnwu/magisk-files@master/{magisk_ver}.json").content)['magisk']['link']
magisk_version = json.loads(requests.get(
f"https://fastly.jsdelivr.net/gh/topjohnwu/magisk-files@master/{magisk_ver}.json").content)['magisk']['version']
with open(os.environ['WSA_WORK_ENV'], 'a') as environ_file:
environ_file.write(f'MAGISK_VERSION={magisk_version}\n')
print(f"download link: {magisk_link}", flush=True)
with open(download_dir/tempScript, 'a') as f:

View File

@ -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,12 @@ 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()
print(f'WSA Version={wsa_long_ver}\n')
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:

View File

@ -34,7 +34,7 @@
<XmlUpdateFragmentType>FileUrl</XmlUpdateFragmentType>
<XmlUpdateFragmentType>FileDecryption</XmlUpdateFragmentType>
</infoTypes>
<deviceAttributes>BranchReadinessLevel=CB;CurrentBranch=rs_prerelease;OEMModel=Virtual Machine;FlightRing={};AttrDataVer=21;SystemManufacturer=Microsoft Corporation;InstallLanguage=en-US;OSUILocale=en-US;InstallationType=Client;FlightingBranchName=external;FirmwareVersion=Hyper-V UEFI Release v2.5;SystemProductName=Virtual Machine;OSSkuId=48;FlightContent=Branch;App=WU;OEMName_Uncleaned=Microsoft Corporation;AppVer=10.0.16184.1001;OSArchitecture=AMD64;SystemSKU=None;UpdateManagementGroup=2;IsFlightingEnabled=1;IsDeviceRetailDemo=0;TelemetryLevel=3;OSVersion=10.0.16184.1001;DeviceFamily=Windows.Desktop;</deviceAttributes>
<deviceAttributes>BranchReadinessLevel=CB;CurrentBranch=rs_prerelease;OEMModel=Virtual Machine;FlightRing={};AttrDataVer=21;SystemManufacturer=Microsoft Corporation;InstallLanguage=en-US;OSUILocale=en-US;InstallationType=Client;FlightingBranchName=external;FirmwareVersion=Hyper-V UEFI Release v2.5;SystemProductName=Virtual Machine;OSSkuId=48;FlightContent=Branch;App=WU;OEMName_Uncleaned=Microsoft Corporation;AppVer=10.0.22621.900;OSArchitecture=AMD64;SystemSKU=None;UpdateManagementGroup=2;IsFlightingEnabled=1;IsDeviceRetailDemo=0;TelemetryLevel=3;OSVersion=10.0.22621.900;DeviceFamily=Windows.Desktop;</deviceAttributes>
</GetExtendedUpdateInfo2>
</s:Body>
</s:Envelope>

View File

@ -670,7 +670,7 @@
</ClientPreferredLanguages>
<ProductsParameters>
<SyncCurrentVersionOnly>false</SyncCurrentVersionOnly>
<DeviceAttributes>BranchReadinessLevel=CB;CurrentBranch=rs_prerelease;OEMModel=Virtual Machine;FlightRing={};AttrDataVer=21;SystemManufacturer=Microsoft Corporation;InstallLanguage=en-US;OSUILocale=en-US;InstallationType=Client;FlightingBranchName=external;FirmwareVersion=Hyper-V UEFI Release v2.5;SystemProductName=Virtual Machine;OSSkuId=48;FlightContent=Branch;App=WU;OEMName_Uncleaned=Microsoft Corporation;AppVer=10.0.16184.1001;OSArchitecture=AMD64;SystemSKU=None;UpdateManagementGroup=2;IsFlightingEnabled=1;IsDeviceRetailDemo=0;TelemetryLevel=3;OSVersion=10.0.16184.1001;DeviceFamily=Windows.Desktop;</DeviceAttributes>
<DeviceAttributes>BranchReadinessLevel=CB;CurrentBranch=rs_prerelease;OEMModel=Virtual Machine;FlightRing={};AttrDataVer=21;SystemManufacturer=Microsoft Corporation;InstallLanguage=en-US;OSUILocale=en-US;InstallationType=Client;FlightingBranchName=external;FirmwareVersion=Hyper-V UEFI Release v2.5;SystemProductName=Virtual Machine;OSSkuId=48;FlightContent=Branch;App=WU;OEMName_Uncleaned=Microsoft Corporation;AppVer=10.0.22621.900;OSArchitecture=AMD64;SystemSKU=None;UpdateManagementGroup=2;IsFlightingEnabled=1;IsDeviceRetailDemo=0;TelemetryLevel=3;OSVersion=10.0.22621.900;DeviceFamily=Windows.Desktop;</DeviceAttributes>
<CallerAttributes>Interactive=1;IsSeeker=0;</CallerAttributes>
<Products/>
</ProductsParameters>