mirror of
https://github.com/j-hc/revanced-magisk-module.git
synced 2025-04-30 14:44:32 +02:00
fix merged apks for building module
This commit is contained in:
parent
1792aa367b
commit
a8ddca39a4
2
build.sh
2
build.sh
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
trap "rm -rf temp/*tmp.* temp/*/*tmp.*; exit 130" INT
|
trap "rm -rf temp/*tmp.* temp/*/*tmp.* temp/*-temporary-files; exit 130" INT
|
||||||
|
|
||||||
if [ "${1-}" = "clean" ]; then
|
if [ "${1-}" = "clean" ]; then
|
||||||
rm -rf temp build logs build.md
|
rm -rf temp build logs build.md
|
||||||
|
35
utils.sh
35
utils.sh
@ -201,6 +201,26 @@ isoneof() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
merge_splits() {
|
||||||
|
local bundle=$1 output=$2
|
||||||
|
gh_dl "$TEMP_DIR/apkeditor.jar" "https://github.com/REAndroid/APKEditor/releases/download/V1.3.9/APKEditor-1.3.9.jar" >/dev/null || return 1
|
||||||
|
if ! OP=$(java -jar "$TEMP_DIR/apkeditor.jar" merge -i "${bundle}" -o "${bundle}.mzip" -clean-meta -f 2>&1); then
|
||||||
|
epr "$OP"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
# this is required because of apksig
|
||||||
|
mkdir "${bundle}-zip"
|
||||||
|
unzip -qo "${bundle}.mzip" -d "${bundle}-zip"
|
||||||
|
cd "${bundle}-zip" || abort
|
||||||
|
zip -0rq "../../${bundle}.zip" .
|
||||||
|
cd ../.. || abort
|
||||||
|
pr "Merging splits"
|
||||||
|
patch_apk "${bundle}.zip" "${output}" "--exclusive" "${args[cli]}" "${args[ptjar]}"
|
||||||
|
local ret=$?
|
||||||
|
rm -r "${bundle}-zip" "${bundle}.zip" "${bundle}.mzip" || :
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
|
||||||
# -------------------- apkmirror --------------------
|
# -------------------- apkmirror --------------------
|
||||||
apk_mirror_search() {
|
apk_mirror_search() {
|
||||||
local resp="$1" dpi="$2" arch="$3" apk_bundle="$4"
|
local resp="$1" dpi="$2" arch="$3" apk_bundle="$4"
|
||||||
@ -240,15 +260,8 @@ dl_apkmirror() {
|
|||||||
url=$(echo "$resp" | $HTMLQ --base https://www.apkmirror.com --attribute href "a.btn") || return 1
|
url=$(echo "$resp" | $HTMLQ --base https://www.apkmirror.com --attribute href "a.btn") || return 1
|
||||||
url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "span > a[rel = nofollow]") || return 1
|
url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "span > a[rel = nofollow]") || return 1
|
||||||
if [ "$is_bundle" = true ]; then
|
if [ "$is_bundle" = true ]; then
|
||||||
gh_dl "$TEMP_DIR/apkeditor.jar" "https://github.com/REAndroid/APKEditor/releases/latest/download/APKEditor-1.3.9.jar" >/dev/null || return 1
|
|
||||||
req "$url" "${output}.apkm"
|
req "$url" "${output}.apkm"
|
||||||
java -jar "$TEMP_DIR/apkeditor.jar" merge -i "${output}.apkm" -o "${output}.zip" -clean-meta -f || return 1
|
merge_splits "${output}.apkm" "${output}"
|
||||||
mkdir "${output}-zip" || :
|
|
||||||
unzip -qo "${output}.zip" -d "${output}-zip"
|
|
||||||
cd "${output}-zip" || abort
|
|
||||||
zip -FS0rq "../../${output}" .
|
|
||||||
cd ../.. || abort
|
|
||||||
rm -r "${output}-zip" "${output}.apkm" "${output}.zip"
|
|
||||||
else
|
else
|
||||||
req "$url" "${output}"
|
req "$url" "${output}"
|
||||||
fi
|
fi
|
||||||
@ -334,8 +347,10 @@ patch_apk() {
|
|||||||
--keystore-entry-password=123456789 --keystore-password=123456789 --signer=jhc --keystore-entry-alias=jhc --options=options.json"
|
--keystore-entry-password=123456789 --keystore-password=123456789 --signer=jhc --keystore-entry-alias=jhc --options=options.json"
|
||||||
if [ "$OS" = Android ]; then cmd+=" --custom-aapt2-binary=${AAPT2}"; fi
|
if [ "$OS" = Android ]; then cmd+=" --custom-aapt2-binary=${AAPT2}"; fi
|
||||||
pr "$cmd"
|
pr "$cmd"
|
||||||
eval "$cmd"
|
if eval "$cmd"; then [ -f "$patched_apk" ]; else
|
||||||
[ -f "$patched_apk" ]
|
rm "$patched_apk" 2>/dev/null || :
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_sig() {
|
check_sig() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user