Skip to content

Commit 10a3072

Browse files
j-hcthunderkex
authored andcommitted
update merge_splits
Signed-off-by: thunderkex <thunderkex@gmail.com>
1 parent 17fe415 commit 10a3072

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
set -euo pipefail
44
shopt -s nullglob
5-
trap "rm -rf temp/*tmp.* temp/*/*tmp.* temp/*-temporary-files; kill 0; exit 130" INT
65

76
# Color output
87
RED='\033[0;31m'
@@ -26,6 +25,13 @@ fi
2625

2726
source utils.sh
2827

28+
trap "abort" INT
29+
30+
if [ "${1-}" = "clean" ]; then
31+
rm -r "$TEMP_DIR" "$BUILD_DIR" build.md
32+
exit 0
33+
fi
34+
2935
jq --version >/dev/null || abort "\`jq\` is not installed. install it with 'apt install jq' or equivalent"
3036
java --version >/dev/null || abort "\`openjdk 17\` is not installed. install it with 'apt install openjdk-17-jre' or equivalent"
3137
zip --version >/dev/null || abort "\`zip\` is not installed. install it with 'apt install zip' or equivalent"

utils.sh

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ wpr() {
4646
}
4747
abort() {
4848
epr "ABORT: ${1-}"
49-
exit 1
49+
rm -rf ./${TEMP_DIR}/*tmp.* ./${TEMP_DIR}/*/*tmp.* ./${TEMP_DIR}/*-temporary-files
50+
kill -n 9 0
5051
}
5152
java() { env -i java "$@"; }
5253

@@ -190,8 +191,8 @@ config_update() {
190191
else
191192
last_patches=$(gh_req "$rv_rel/tags/${PATCHES_VER}" -)
192193
fi
193-
if ! last_patches=$(jq -e -r '.assets[] | select(.name | endswith("asc") | not) | .name' <<<"$last_patches"); then
194-
abort oops
194+
if ! last_patches=$(jq -e -r '.assets[] | select(.name | (endswith("asc") or endswith("json")) | not) | .name' <<<"$last_patches"); then
195+
abort "config_update error: '$last_patches'"
195196
fi
196197
if [ "$last_patches" ]; then
197198
if ! OP=$(grep "^Patches: ${PATCHES_SRC%%/*}/" build.md | grep -m1 "$last_patches"); then
@@ -482,14 +483,9 @@ merge_splits() {
482483
cd "${bundle}-zip" || abort
483484
zip -0rq "${CWD}/${bundle}.zip" .
484485
)
485-
# if building module, sign the merged apk properly
486-
if isoneof "module" "${build_mode_arr[@]}"; then
487-
patch_apk "${bundle}.zip" "${output}" "--exclusive" "${args[cli]}" "${args[ptjar]}"
488-
local ret=$?
489-
else
490-
cp "${bundle}.zip" "${output}"
491-
local ret=$?
492-
fi
486+
# sign the merged apk properly
487+
patch_apk "${bundle}.zip" "${output}" "--exclusive" "${args[cli]}" "${args[ptjar]}"
488+
local ret=$?
493489
rm -r "${bundle}-zip" "${bundle}.zip" "${bundle}.mzip" || :
494490
return $ret
495491
}
@@ -816,7 +812,7 @@ build_rv() {
816812
for build_mode in "${build_mode_arr[@]}"; do
817813
patcher_args=("${p_patcher_args[@]}")
818814
pr "Building '${table}' in '$build_mode' mode"
819-
if [ -n "$microg_patch" ] || [ -f "${stock_apk}.apkm" ]; then
815+
if [ -n "$microg_patch" ]; then
820816
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}-${build_mode}.apk"
821817
else
822818
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk"

0 commit comments

Comments
 (0)