Skip to content

Commit

Permalink
upstream sync
Browse files Browse the repository at this point in the history
  • Loading branch information
thrwKappu committed Jan 22, 2025
1 parent 612f7c5 commit 1ddffed
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
else
UPDATE_CFG=$(./build.sh config.toml --config-update)
if [ "$UPDATE_CFG" ]; then
echo "'$UPDATE_CFG'"
echo "SHOULD_BUILD=1" >> $GITHUB_OUTPUT
else
echo "SHOULD_BUILD=0" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion rvcmm-template/customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ install() {
}

if [ $INS = true ] && ! install; then abort; fi
BASEPATHLIB=${BASEPATH}/lib/${ARCH}
if [ $INS = true ] || [ -z "$(ls -A1 "$BASEPATHLIB")" ]; then
ui_print " - Extracting native libs"
BASEPATHLIB=${BASEPATH}/lib/${ARCH}
if [ ! -d "$BASEPATHLIB" ]; then mkdir -p "$BASEPATHLIB"; else rm -f "$BASEPATHLIB"/* >/dev/null 2>&1 || :; fi
if ! op=$(unzip -o -j "$MODPATH/$PKG_NAME.apk" "lib/${ARCH_LIB}/*" -d "$BASEPATHLIB" 2>&1); then
ui_print " ERROR: extracting native libs failed"
Expand Down
30 changes: 17 additions & 13 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ _req() {
local ip="$1" op="$2"
shift 2
if [ "$op" = - ]; then
wget -nv -O "$op" "$@" "$ip"
curl -L -c "$TEMP_DIR/cookie.txt" -b "$TEMP_DIR/cookie.txt" --connect-timeout 5 --retry 0 --fail -s -S "$@" "$ip"
else
if [ -f "$op" ]; then return; fi
local dlp
Expand All @@ -195,16 +195,16 @@ _req() {
while [ -f "$dlp" ]; do sleep 1; done
return
fi
wget -nv -O "$dlp" "$@" "$ip" || return 1
curl -L -c "$TEMP_DIR/cookie.txt" -b "$TEMP_DIR/cookie.txt" --connect-timeout 5 --retry 0 --fail -s -S "$@" "$ip" -o "$dlp" || return 1
mv -f "$dlp" "$op"
fi
}
req() { _req "$1" "$2" --header="User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0"; }
gh_req() { _req "$1" "$2" --header="$GH_HEADER"; }
req() { _req "$1" "$2" -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0"; }
gh_req() { _req "$1" "$2" -H "$GH_HEADER"; }
gh_dl() {
if [ ! -f "$1" ]; then
pr "Getting '$1' from '$2'"
_req "$2" "$1" --header="$GH_HEADER" --header="Accept: application/octet-stream"
_req "$2" "$1" -H "$GH_HEADER" -H "Accept: application/octet-stream"
fi
}

Expand All @@ -221,10 +221,10 @@ semver_validate() {
[ ${#ac} = 0 ]
}
get_patch_last_supported_ver() {
local pkg_name=$1 inc_sel=$2 _exc_sel=$3 _exclusive=$4 # TODO: resolve using all of these
local list_patches=$1 pkg_name=$2 inc_sel=$3 _exc_sel=$4 _exclusive=$5 # TODO: resolve using all of these
local op
if [ "$inc_sel" ]; then
if ! op=$(java -jar "$rv_cli_jar" list-patches "$rv_patches_jar" -f "$pkg_name" -v -p 2>&1 | awk '{$1=$1}1'); then
if ! op=$(awk '{$1=$1}1' <<<"$list_patches"); then
epr "list-patches: '$op'"
return 1
fi
Expand Down Expand Up @@ -415,7 +415,7 @@ get_archive_pkg_name() { echo "$__ARCHIVE_PKG_NAME__"; }

patch_apk() {
local stock_input=$1 patched_apk=$2 patcher_args=$3 rv_cli_jar=$4 rv_patches_jar=$5
local cmd="java -jar $rv_cli_jar patch $stock_input --purge -o $patched_apk -p $rv_patches_jar --keystore=ks.keystore \
local cmd="env -u GITHUB_REPOSITORY java -jar $rv_cli_jar patch $stock_input --purge -o $patched_apk -p $rv_patches_jar --keystore=ks.keystore \
--keystore-entry-password=123456789 --keystore-password=123456789 --signer=jhc --keystore-entry-alias=jhc $patcher_args"
pr "$cmd"
if eval "$cmd"; then [ -f "$patched_apk" ]; else
Expand Down Expand Up @@ -466,9 +466,12 @@ build_rv() {
epr "empty pkg name, not building ${table}."
return 0
fi
local list_patches
list_patches=$(java -jar "$rv_cli_jar" list-patches "$rv_patches_jar" -f "$pkg_name" -v -p 2>&1)

local get_latest_ver=false
if [ "$version_mode" = auto ]; then
if ! version=$(get_patch_last_supported_ver "$pkg_name" \
if ! version=$(get_patch_last_supported_ver "$list_patches" "$pkg_name" \
"${args[included_patches]}" "${args[excluded_patches]}" "${args[exclusive_patches]}"); then
exit 1
elif [ -z "$version" ]; then get_latest_ver=true; fi
Expand Down Expand Up @@ -520,8 +523,7 @@ build_rv() {
log "* **${app_name}** (${arch}): v${version}"

local microg_patch
microg_patch=$(java -jar "$rv_cli_jar" list-patches "$rv_patches_jar" -f "$pkg_name" -v -p 2>&1 |
grep "^Name: " | grep -i "gmscore\|microg" || :) microg_patch=${microg_patch#*: }
microg_patch=$(grep "^Name: " <<<"$list_patches" | grep -i "gmscore\|microg" || :) microg_patch=${microg_patch#*: }
if [ -n "$microg_patch" ] && [[ ${p_patcher_args[*]} =~ $microg_patch ]]; then
epr "microg related patches are automatically handled by builder."
p_patcher_args=("${p_patcher_args[@]//-[ei] ${microg_patch}/}")
Expand All @@ -536,13 +538,15 @@ build_rv() {
pr "Building '${table}' in '$build_mode' mode"
if [ -n "$microg_patch" ]; then
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}-${build_mode}.apk"
else
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk"
fi
if [ -n "$microg_patch" ]; then
if [ "$build_mode" = apk ]; then
patcher_args+=("-e \"${microg_patch}\"")
elif [ "$build_mode" = module ]; then
patcher_args+=("-d \"${microg_patch}\"")
fi
else
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk"
fi
if [ "${args[riplib]}" = true ]; then
patcher_args+=("--rip-lib x86_64 --rip-lib x86")
Expand Down

0 comments on commit 1ddffed

Please sign in to comment.