fall back to other apk providers

This commit is contained in:
j-hc 2023-05-04 22:02:18 +03:00
parent d2d838d1c3
commit 9c026f2e9e
No known key found for this signature in database
GPG Key ID: FCBF5E9C57092AD9
2 changed files with 36 additions and 26 deletions

View File

@ -55,7 +55,7 @@ if [ "$LOGGING_F" = true ]; then mkdir -p logs; fi
#check_deps #check_deps
jq --version >/dev/null || abort "\`jq\` is not installed. install it with 'apt install jq' or equivalent" jq --version >/dev/null || abort "\`jq\` is not installed. install it with 'apt install jq' or equivalent"
java --version | grep openjdk | grep 17 >/dev/null || abort "\`openjdk 17\` is not installed. install it with 'apt install openjdk-17-jre-headless' or equivalent" java --version >/dev/null || abort "\`openjdk 17\` is not installed. install it with 'apt install openjdk-17-jre-headless' or equivalent"
zip --version >/dev/null || abort "\`zip\` is not installed. install it with 'apt install zip' or equivalent" zip --version >/dev/null || abort "\`zip\` is not installed. install it with 'apt install zip' or equivalent"
# -- # --

View File

@ -325,32 +325,42 @@ build_rv() {
local version_f=${version// /} local version_f=${version// /}
local stock_apk="${TEMP_DIR}/${pkg_name}-${version_f}-${arch}.apk" local stock_apk="${TEMP_DIR}/${pkg_name}-${version_f}-${arch}.apk"
if [ ! -f "$stock_apk" ]; then if [ ! -f "$stock_apk" ]; then
if [ "$dl_from" = apkmirror ]; then for dl_p in apkmirror uptodown apkmonk; do
pr "Downloading '${app_name}' from APKMirror" if [ "$dl_p" = apkmirror ]; then
local apkm_arch if [ -z "${args[apkmirror_dlurl]}" ]; then continue; fi
if [ "$arch" = "all" ]; then pr "Downloading '${app_name}' from APKMirror"
apkm_arch="universal" local apkm_arch
elif [ "$arch" = "arm64-v8a" ]; then if [ "$arch" = "all" ]; then apkm_arch="universal";
apkm_arch="arm64-v8a" elif [ "$arch" = "arm64-v8a" ]; then apkm_arch="arm64-v8a";
elif [ "$arch" = "arm-v7a" ]; then elif [ "$arch" = "arm-v7a" ]; then apkm_arch="armeabi-v7a"; fi
apkm_arch="armeabi-v7a" if ! dl_apkmirror "${args[apkmirror_dlurl]}" "$version" "$stock_apk" APK "$apkm_arch" "${args[dpi]}"; then
fi epr "ERROR: Could not find any release of '${app_name}' with version '${version}', arch '${apkm_arch}' and dpi '${args[dpi]}' from APKMirror"
if ! dl_apkmirror "${args[apkmirror_dlurl]}" "$version" "$stock_apk" APK "$apkm_arch" "${args[dpi]}"; then continue
epr "ERROR: Could not find any release of '${app_name}' with version '${version}', arch '${apkm_arch}' and dpi '${args[dpi]}' from APKMirror" fi
return 0 break
fi elif [ "$dl_p" = uptodown ]; then
elif [ "$dl_from" = uptodown ]; then if [ -z "${args[uptodown_dlurl]}" ]; then continue; fi
pr "Downloading '${app_name}' from Uptodown" if [ -z "${uptwod_resp:-}" ]; then uptwod_resp=$(get_uptodown_resp "${args[uptodown_dlurl]}"); fi
if ! dl_uptodown "$uptwod_resp" "$version" "$stock_apk"; then pr "Downloading '${app_name}' from Uptodown"
epr "ERROR: Could not download ${app_name} from Uptodown" if ! dl_uptodown "$uptwod_resp" "$version" "$stock_apk"; then
return 0 epr "ERROR: Could not download ${app_name} from Uptodown"
fi continue
elif [ "$dl_from" = apkmonk ]; then fi
pr "Downloading '${app_name}' from Apkmonk" break
if ! dl_apkmonk "$apkmonk_resp" "$version" "$stock_apk"; then elif [ "$dl_p" = apkmonk ]; then
epr "ERROR: Could not download ${app_name} from Apkmonk" if [ -z "${args[apkmonk_dlurl]}" ]; then continue; fi
return 0 if [ -z "${apkmonk_resp:-}" ]; then apkmonk_resp=$(get_apkmonk_resp "${args[apkmonk_dlurl]}"); fi
pr "Downloading '${app_name}' from Apkmonk"
if ! dl_apkmonk "$apkmonk_resp" "$version" "$stock_apk"; then
epr "ERROR: Could not download ${app_name} from Apkmonk"
continue
fi
break
fi fi
done
if [ ! -f "$stock_apk" ]; then
epr "ERROR: Could not download ${app_name} from any provider"
return 0
fi fi
fi fi
if [ "${arch}" = "all" ]; then if [ "${arch}" = "all" ]; then