This commit is contained in:
Peter Njeim 2022-09-12 15:33:48 -03:00
commit 9e39211eb9
3 changed files with 50 additions and 32 deletions

View File

@ -29,8 +29,7 @@ if [ "$HOST_ARCH" != "x86_64" ] && [ "$HOST_ARCH" != "aarch64" ]; then
fi
cd "$(dirname "$0")" || exit 1
trap umount_clean EXIT
PARENT_DIR="$(dirname "$PWD")"
# export TMPDIR=$PARENT_DIR/WORK_DIR_
# export TMPDIR=$(dirname "$PWD")/WORK_DIR_
if [ "$TMPDIR" ] && [ ! -d "$TMPDIR" ]; then
mkdir -p "$TMPDIR"
fi
@ -93,7 +92,7 @@ default() {
ARCH=x64
RELEASE_TYPE=retail
MAGISK_VER=stable
GAPPS_BRAND=OpenGApps
GAPPS_BRAND=MindTheGapps
GAPPS_VARIANT=pico
ROOT_SOL=magisk
}
@ -306,8 +305,8 @@ if [ -z "${OFFLINE+x}" ]; then
if [ -z "${CUSTOM_MAGISK+x}" ]; then
python3 generateMagiskLink.py "$MAGISK_VER" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
fi
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
python3 generateGappsLink.py "$ARCH" "$GAPPS_VARIANT" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
if [ "$GAPPS_BRAND" != "none" ]; then
python3 generateGappsLink.py "$ARCH" "$GAPPS_BRAND" "$GAPPS_VARIANT" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME" || abort
fi
echo "Download Artifacts"

View File

@ -27,15 +27,21 @@ import re
from pathlib import Path
arch = sys.argv[1]
variant = sys.argv[2]
download_dir = Path.cwd().parent / "download" if sys.argv[3] == "" else Path(sys.argv[3]).resolve()
tempScript = sys.argv[4]
print(f"Generating OpenGApps download link: arch={arch} variant={variant}", flush=True)
brand = sys.argv[2]
variant = sys.argv[3]
download_dir = Path.cwd().parent / \
"download" if sys.argv[4] == "" else Path(sys.argv[4]).resolve()
tempScript = sys.argv[5]
print(
f"Generating {brand} download link: arch={arch} variant={variant}", flush=True)
abi_map = {"x64": "x86_64", "arm64": "arm64"}
if brand == "OpenGApps":
# Use Android 12.1 build of OpenGApps (also supports more variants like Full)
if arch == "x64" and variant == "pico":
link = "http://peternjeim.ddns.net:8081/ipfs/QmPDiAyqUvZHo9QU7WfoEE9XMqC8ppGyUsSwKQY7chfwHX"
elif arch == "x64" and variant == "full":
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
@ -52,11 +58,19 @@ else:
f'https://sourceforge.net/projects/opengapps/rss?path=/{abi_map[arch]}&limit=100')
link = re.search(f'https://.*{abi_map[arch]}/.*{release}.*{variant}.*\.zip/download', res.text).group().replace(
'.zip/download', '.zip').replace('sourceforge.net/projects/opengapps/files', 'downloads.sourceforge.net/project/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(
'.zip/download', '.zip').replace('sourceforge.net/projects/wsa-mtg/files', 'downloads.sourceforge.net/project/wsa-mtg')
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')
f.writelines(f' out=OpenGApps-{arch}-{variant}.zip\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.close

View File

@ -32,8 +32,13 @@ print(f"Generating Magisk download link: release type={magisk_ver}", flush=True)
if not magisk_ver:
magisk_ver = "stable"
if magisk_ver == "stable" or magisk_ver == "beta" or magisk_ver == "canary" or magisk_ver == "debug":
try:
magisk_link = json.loads(requests.get(
f"https://github.com/topjohnwu/magisk-files/raw/master/{magisk_ver}.json").content)['magisk']['link']
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']
print(f"download link: {magisk_link}", flush=True)
with open(download_dir/tempScript, 'a') as f: