diff options
| author | Anton Bobov <anton@bobov.name> | 2026-08-04 20:43:55 +0500 |
|---|---|---|
| committer | Anton Bobov <anton@bobov.name> | 2026-08-04 20:43:55 +0500 |
| commit | fa16152d6b7f8cfb7d601ec9e4bda27c3693e697 (patch) | |
| tree | aeda6555d67411c30dbc0f8a605d437729be29a4 | |
| parent | bd09a383f1f345e51290f7d22fb61feba4df1af9 (diff) | |
rustore-apk-get: use RU government CA
| -rwxr-xr-x | rustore-apk-get | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/rustore-apk-get b/rustore-apk-get index 5479c5d..a5f7b20 100755 --- a/rustore-apk-get +++ b/rustore-apk-get @@ -14,6 +14,7 @@ set -euo pipefail # @option -q --query search string # @option -o --output=`_default_output` Output directory/file # @arg package_name Application package name +# @env RU_GOV_CERTIFICATE_PATH! Path to Russian Ministry of Digital Development (MinCifry) certificates BASE_URL=https://backapi.rustore.ru PAGE_SIZE=10 @@ -23,7 +24,31 @@ _default_output() { } _curl() { - curl --retry 3 --header 'ruStoreVerCode: 1105002' "$@" + curl \ + --cacert "$RU_GOV_CERTIFICATE_PATH" \ + --retry 3 \ + --header 'ruStoreVerCode: 1105002' \ + "$@" +} + +_aria2() { + aria2c \ + --ca-certificate="$RU_GOV_CERTIFICATE_PATH" \ + --header='ruStoreVerCode: 1105002' \ + "$@" +} + +_download_file() { + local output_file="$1" download_url="$2" + + if command -v aria2c >/dev/null; then + local aria2_dir aria2_out + aria2_dir=$(dirname "$output_file") + aria2_out=$(basename "$output_file") + _aria2 --dir="$aria2_dir" --out="$aria2_out" "$download_url" + else + _curl --progress-bar --output "$output_file" "$download_url" + fi } _curl_silent() { @@ -90,7 +115,7 @@ download_apk() { temp_file_apk=$(mktemp) trap 'rm -f "$temp_file_zip" "$temp_file_apk"' EXIT - _curl --progress-bar --output "$temp_file_zip" "$download_url" + _download_file "$temp_file_zip" "$download_url" existing_file_hash=$(xxh64sum "$temp_file_zip" | cut -d ' ' -f 1) |
