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 *.sh text eol=lf
*.exe binary *.exe binary
*.apk binary *.apk binary

View File

@ -62,6 +62,11 @@ on:
# required: true # required: true
# default: false # default: false
# type: boolean # type: boolean
# skip_download_wsa:
# description: Skip WSA Download
# required: true
# default: false
# type: boolean
compression: compression:
description: "Compression Algorithm" description: "Compression Algorithm"
required: true required: true
@ -104,7 +109,7 @@ jobs:
DOWNLOAD_DIR=../download DOWNLOAD_DIR=../download
DOWNLOAD_CONF_NAME=download.list 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 }}]}" ARCH="${opts[ARCH,${{ inputs.arch }}]}"
@ -215,6 +220,8 @@ jobs:
NOFIX_PROPS="${opts[NOFIX_PROPS,${{ inputs.nofix_props }}]}" 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 }}]}" COMPRESSION="--compress --compress-format ${opts[COMPRESSION,${{ inputs.compression }}]}"
if [[ "${{ inputs.gapps_var }}" == "Custom"* ]]; then if [[ "${{ inputs.gapps_var }}" == "Custom"* ]]; then
@ -232,7 +239,7 @@ jobs:
OFFLINE="--offline" OFFLINE="--offline"
fi 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[*]}" echo "COMMAND_LINE=${COMMAND_LINE[*]}"
chmod +x ./build.sh chmod +x ./build.sh
@ -247,7 +254,7 @@ jobs:
elif [[ "${{ inputs.magisk_ver }}" == "Custom" ]]; then elif [[ "${{ inputs.magisk_ver }}" == "Custom" ]]; then
magiskVer="_Magisk-Custom" magiskVer="_Magisk-Custom"
else 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 fi
export magiskVer export magiskVer

View File

@ -42,6 +42,10 @@ SUDO="$(which sudo 2>/dev/null)"
if [ -z "$SUDO" ]; then if [ -z "$SUDO" ]; then
unset SUDO unset SUDO
fi 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() { umount_clean() {
if [ -d "$MOUNT_DIR" ]; then if [ -d "$MOUNT_DIR" ]; then
echo "Cleanup Work Directory" echo "Cleanup Work Directory"
@ -88,7 +92,7 @@ abort() {
} }
trap abort INT TERM trap abort INT TERM
function Gen_Rand_Str { Gen_Rand_Str() {
head /dev/urandom | tr -dc A-Za-z0-9 | head -c"$1" head /dev/urandom | tr -dc A-Za-z0-9 | head -c"$1"
} }
@ -213,6 +217,7 @@ Additional Options:
--compress Compress the WSA, The default format is 7z, you can use the format specified by --compress-format --compress Compress the WSA, The default format is 7z, you can use the format specified by --compress-format
--offline Build WSA offline --offline Build WSA offline
--magisk-custom Install custom Magisk --magisk-custom Install custom Magisk
--skip-download-wsa Skip download WSA
--debug Debug build mode --debug Debug build mode
--help Show this help message and exit --help Show this help message and exit
--nofix-props No fix \"build.prop\" --nofix-props No fix \"build.prop\"
@ -243,6 +248,7 @@ ARGUMENT_LIST=(
"magisk-custom" "magisk-custom"
"debug" "debug"
"help" "help"
"skip-download-wsa"
) )
default default
@ -271,6 +277,7 @@ while [[ $# -gt 0 ]]; do
--magisk-custom ) CUSTOM_MAGISK="debug"; shift ;; --magisk-custom ) CUSTOM_MAGISK="debug"; shift ;;
--magisk-ver ) MAGISK_VER="$2"; shift 2 ;; --magisk-ver ) MAGISK_VER="$2"; shift 2 ;;
--debug ) DEBUG="on"; shift ;; --debug ) DEBUG="on"; shift ;;
--skip-download-wsa ) DOWN_WSA="no"; shift ;;
--help ) usage; exit 0 ;; --help ) usage; exit 0 ;;
-- ) shift; break;; -- ) shift; break;;
esac esac
@ -324,6 +331,7 @@ require_su() {
} }
declare -A RELEASE_NAME_MAP=(["retail"]="Retail" ["RP"]="Release Preview" ["WIS"]="Insider Slow" ["WIF"]="Insider Fast") 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 RELEASE_NAME=${RELEASE_NAME_MAP[$RELEASE_TYPE]} || abort
echo -e "Build: RELEASE_TYPE=$RELEASE_NAME" echo -e "Build: RELEASE_TYPE=$RELEASE_NAME"
@ -345,22 +353,39 @@ if [ "$CUSTOM_MAGISK" ]; then
fi fi
fi fi
fi fi
ANDROID_API=32
update_gapps_zip_name() {
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
GAPPS_PATH="$DOWNLOAD_DIR"/OpenGApps-$ARCH-$GAPPS_VARIANT.zip # 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 else
GAPPS_PATH="$DOWNLOAD_DIR"/MindTheGapps-"$ARCH".zip GAPPS_ZIP_NAME="$GAPPS_BRAND-$ARCH-${ANDROID_API_MAP[$ANDROID_API]}".zip
fi fi
GAPPS_PATH=$DOWNLOAD_DIR/$GAPPS_ZIP_NAME
}
update_gapps_zip_name
if [ -z "${OFFLINE+x}" ]; then if [ -z "${OFFLINE+x}" ]; then
trap 'rm -f -- "${DOWNLOAD_DIR:?}/${DOWNLOAD_CONF_NAME}"' EXIT trap 'rm -f -- "${DOWNLOAD_DIR:?}/${DOWNLOAD_CONF_NAME}"' EXIT
require_su require_su
if [ "${DOWN_WSA}" != "no" ]; then
echo "Generate Download Links" 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=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 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
if [ "$GAPPS_BRAND" != "none" ]; then 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 fi
echo "Download Artifacts" echo "Download Artifacts"
@ -391,10 +416,6 @@ fi
echo "Extract WSA" echo "Extract WSA"
if [ -f "$WSA_ZIP_PATH" ]; then 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 if ! python3 extractWSA.py "$ARCH" "$WSA_ZIP_PATH" "$WORK_DIR"; then
echo "Unzip WSA failed, is the download incomplete?" echo "Unzip WSA failed, is the download incomplete?"
CLEAN_DOWNLOAD_WSA=1 CLEAN_DOWNLOAD_WSA=1
@ -403,6 +424,10 @@ 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
@ -410,11 +435,15 @@ fi
echo "Extract Magisk" echo "Extract Magisk"
if [ -f "$MAGISK_PATH" ]; then if [ -f "$MAGISK_PATH" ]; then
version=""
versionCode=0
if ! python3 extractMagisk.py "$ARCH" "$MAGISK_PATH" "$WORK_DIR"; then if ! python3 extractMagisk.py "$ARCH" "$MAGISK_PATH" "$WORK_DIR"; then
echo "Unzip Magisk failed, is the download incomplete?" echo "Unzip Magisk failed, is the download incomplete?"
CLEAN_DOWNLOAD_MAGISK=1 CLEAN_DOWNLOAD_MAGISK=1
abort abort
fi 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 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 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 $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 else
if ! unzip "$GAPPS_PATH" "system/*" -x "system/addon.d/*" "system/system_ext/priv-app/SetupWizard/*" -d "$WORK_DIR"/gapps; then 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?" echo "Unzip MindTheGapps failed, package is corrupted?"
CLEAN_DOWNLOAD_GAPPS=1
abort abort
fi fi
mv "$WORK_DIR"/gapps/system/* "$WORK_DIR"/gapps || abort mv "$WORK_DIR"/gapps/system/* "$WORK_DIR"/gapps || abort
@ -507,6 +537,7 @@ echo -e "done\n"
if [ "$REMOVE_AMAZON" ]; then if [ "$REMOVE_AMAZON" ]; then
echo "Remove Amazon Appstore" 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:?}"/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" echo -e "done\n"
fi fi
@ -606,8 +637,8 @@ EOF
fi fi
echo "Merge Language Resources" echo "Merge Language Resources"
cp "$WORK_DIR"/wsa/"$ARCH"/resources.pri "$WORK_DIR"/wsa/pri/en-us.pri 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 && cp "$WORK_DIR"/wsa/"$ARCH"/AppxManifest.xml "$WORK_DIR"/wsa/xml/en-us.xml && {
tee "$WORK_DIR"/wsa/priconfig.xml <<EOF tee "$WORK_DIR"/wsa/priconfig.xml <<EOF
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resources targetOsVersion="10.0.0" majorVersion="1"> <resources targetOsVersion="10.0.0" majorVersion="1">
@ -620,6 +651,7 @@ 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 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 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 done\n"
} || echo -e "Merge Language Resources failed\n"
echo "Add extra packages" echo "Add extra packages"
$SUDO cp -r ../"$ARCH"/system/* "$MOUNT_DIR" || abort $SUDO cp -r ../"$ARCH"/system/* "$MOUNT_DIR" || abort
@ -854,8 +886,8 @@ echo "Generate info"
if [[ "$ROOT_SOL" = "none" ]]; then if [[ "$ROOT_SOL" = "none" ]]; then
name1="" name1=""
elif [[ "$ROOT_SOL" = "" ]]; then elif [ "$ROOT_SOL" = "" ] || [ "$ROOT_SOL" = "magisk" ]; then
name1="-with-magisk-$MAGISK_VER" name1="-with-magisk-$version($versionCode)-$MAGISK_VER"
else else
name1="-with-$ROOT_SOL-$MAGISK_VER" name1="-with-$ROOT_SOL-$MAGISK_VER"
fi fi
@ -863,9 +895,9 @@ if [ "$GAPPS_BRAND" = "none" ]; then
name2="-NoGApps" name2="-NoGApps"
else else
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
name2="-$GAPPS_BRAND-${GAPPS_VARIANT}" name2="-$GAPPS_BRAND-${ANDROID_API_MAP[$ANDROID_API]}-${GAPPS_VARIANT}"
else else
name2="-$GAPPS_BRAND" name2="-$GAPPS_BRAND-${ANDROID_API_MAP[$ANDROID_API]}"
fi fi
if [ "$GAPPS_BRAND" = "OpenGApps" ] && [ "$DEBUG" ]; then if [ "$GAPPS_BRAND" = "OpenGApps" ] && [ "$DEBUG" ]; then
echo ":warning: Since OpenGApps doesn't officially support Android 12.1 yet, lock the variant to pico!" 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. # This file is part of MagiskOnWSALocal.
# #
@ -23,6 +23,7 @@ import sys
import zipfile import zipfile
from pathlib import Path from pathlib import Path
import platform import platform
import os
is_x86_64 = platform.machine() in ("AMD64", "x86_64") is_x86_64 = platform.machine() in ("AMD64", "x86_64")
host_abi = "x64" if is_x86_64 else "arm64" 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) zip.extract(info, workdir / dir)
with zipfile.ZipFile(magisk_zip) as zip: 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( extract_as(
zip, f"lib/{ abi_map[arch][0] }/libmagisk64.so", "magisk64", "magisk") zip, f"lib/{ abi_map[arch][0] }/libmagisk64.so", "magisk64", "magisk")
extract_as( extract_as(

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# #
# This file is part of MagiskOnWSALocal. # This file is part of MagiskOnWSALocal.
# #
@ -47,16 +47,12 @@ with zipfile.ZipFile(wsa_zip_path) as zip:
long_ver = ver_no[1] long_ver = ver_no[1]
ver = long_ver.split(".") ver = long_ver.split(".")
main_ver = ver[0] 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(".") rel = ver_no[3].split(".")
rell = str(rel[0]) rel_long = str(rel[0])
with open(os.environ['WSA_WORK_ENV'], 'a') as g: with open(os.environ['WSA_WORK_ENV'], 'a') as environ_file:
g.write(f'WSA_REL={rell}\n') 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(): if 'language' in f.filename.lower() or 'scale' in f.filename.lower():
name = f.filename.split("-", 1)[1].split(".")[0] name = f.filename.split("-", 1)[1].split(".")[0]
zip.extract(f, workdir) zip.extract(f, workdir)

View File

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

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# #
# This file is part of MagiskOnWSALocal. # This file is part of MagiskOnWSALocal.
# #
@ -31,9 +31,13 @@ variant = sys.argv[3]
download_dir = Path.cwd().parent / \ download_dir = Path.cwd().parent / \
"download" if sys.argv[4] == "" else Path(sys.argv[4]).resolve() "download" if sys.argv[4] == "" else Path(sys.argv[4]).resolve()
tempScript = sys.argv[5] tempScript = sys.argv[5]
android_api = sys.argv[6]
file_name = sys.argv[7]
print( print(
f"Generating {brand} download link: arch={arch} variant={variant}", flush=True) f"Generating {brand} download link: arch={arch} variant={variant}", flush=True)
abi_map = {"x64": "x86_64", "arm64": "arm64"} 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": if brand == "OpenGApps":
# Use Android 12.1 build of OpenGApps (also supports more variants like Full) # Use Android 12.1 build of OpenGApps (also supports more variants like Full)
if arch == "x64" and variant == "pico": if arch == "x64" and variant == "pico":
@ -42,10 +46,6 @@ if brand == "OpenGApps":
link = "http://peternjeim.ddns.net:8081/ipfs/QmULfSMwWuukQR7r9KEvwD2XzsChHTvpswmNqJyEU64jwM" link = "http://peternjeim.ddns.net:8081/ipfs/QmULfSMwWuukQR7r9KEvwD2XzsChHTvpswmNqJyEU64jwM"
# Use official Android 11.0 build of OpenGApps (since I didn't build all variants) # Use official Android 11.0 build of OpenGApps (since I didn't build all variants)
else: 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: try:
res = requests.get(f"https://api.opengapps.org/list") res = requests.get(f"https://api.opengapps.org/list")
j = json.loads(res.content) j = json.loads(res.content)
@ -63,7 +63,7 @@ if brand == "OpenGApps":
elif brand == "MindTheGapps": elif brand == "MindTheGapps":
res = requests.get( res = requests.get(
f'https://sourceforge.net/projects/wsa-mtg/rss?path=/{abi_map[arch]}&limit=100') 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') '.zip/download', '.zip').replace('sourceforge.net/projects/wsa-mtg/files', 'downloads.sourceforge.net/project/wsa-mtg')
print(f"download link: {link}", flush=True) 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: with open(download_dir/tempScript, 'a') as f:
f.writelines(f'{link}\n') f.writelines(f'{link}\n')
f.writelines(f' dir={download_dir}\n') f.writelines(f' dir={download_dir}\n')
if brand == "OpenGApps": f.writelines(f' out={file_name}\n')
f.writelines(f' out={brand}-{arch}-{variant}.zip\n')
elif brand == "MindTheGapps":
f.writelines(f' out={brand}-{arch}.zip\n')

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# #
# This file is part of MagiskOnWSALocal. # This file is part of MagiskOnWSALocal.
# #
@ -18,6 +18,7 @@
# Copyright (C) 2022 LSPosed Contributors # Copyright (C) 2022 LSPosed Contributors
# #
import os
import sys import sys
import json import json
@ -34,10 +35,18 @@ if magisk_ver == "stable" or magisk_ver == "beta" or magisk_ver == "canary" or m
try: try:
magisk_link = json.loads(requests.get( magisk_link = json.loads(requests.get(
f"https://github.com/topjohnwu/magisk-files/raw/master/{magisk_ver}.json").content)['magisk']['link'] 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: except Exception:
print("Failed to fetch from GitHub API, fallbacking to jsdelivr...") print("Failed to fetch from GitHub API, fallbacking to jsdelivr...")
magisk_link = json.loads(requests.get( magisk_link = json.loads(requests.get(
f"https://fastly.jsdelivr.net/gh/topjohnwu/magisk-files@master/{magisk_ver}.json").content)['magisk']['link'] 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) print(f"download link: {magisk_link}", flush=True)
with open(download_dir/tempScript, 'a') as f: 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. # This file is part of MagiskOnWSALocal.
# #
@ -26,6 +26,7 @@ import html
import warnings import warnings
import re import re
from pathlib import Path from pathlib import Path
import os
warnings.filterwarnings("ignore") 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_name = f"Microsoft.VCLibs.140.00.UWPDesktop_{arch}.appx"
# out_file = download_dir / out_file_name # out_file = download_dir / out_file_name
elif re.match(f"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", f): 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_name = f"wsa-{release_type}.zip"
out_file = download_dir / out_file_name out_file = download_dir / out_file_name
else: else:

View File

@ -34,7 +34,7 @@
<XmlUpdateFragmentType>FileUrl</XmlUpdateFragmentType> <XmlUpdateFragmentType>FileUrl</XmlUpdateFragmentType>
<XmlUpdateFragmentType>FileDecryption</XmlUpdateFragmentType> <XmlUpdateFragmentType>FileDecryption</XmlUpdateFragmentType>
</infoTypes> </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> </GetExtendedUpdateInfo2>
</s:Body> </s:Body>
</s:Envelope> </s:Envelope>

View File

@ -670,7 +670,7 @@
</ClientPreferredLanguages> </ClientPreferredLanguages>
<ProductsParameters> <ProductsParameters>
<SyncCurrentVersionOnly>false</SyncCurrentVersionOnly> <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> <CallerAttributes>Interactive=1;IsSeeker=0;</CallerAttributes>
<Products/> <Products/>
</ProductsParameters> </ProductsParameters>