diff options
author | Simon Brulhart | 2019-08-18 12:41:58 +0200 |
---|---|---|
committer | Simon Brulhart | 2019-08-18 12:41:58 +0200 |
commit | d0efc19ab2cae2829203f5ccc17e1d15eb066b22 (patch) | |
tree | aa113346b0d25f19a07699a8465182d80c2ea01f /dlagent | |
parent | dd232907bb628ae2a41e6f955e49af5d28418623 (diff) | |
download | aur-d0efc19ab2cae2829203f5ccc17e1d15eb066b22.tar.gz |
Revert to download workaround
We still need a workaround to download the source archive.
This time, apply the workaround in a custom DLAGENT (based on
the script used by freefilesync-bin).
Diffstat (limited to 'dlagent')
-rwxr-xr-x | dlagent | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/dlagent b/dlagent new file mode 100755 index 000000000000..673ebdbe704e --- /dev/null +++ b/dlagent @@ -0,0 +1,37 @@ +#!/bin/sh +set -eu + +if [ $# -lt 3 ]; then + echo "Error: arguments base_url, file_url and target_file required." >&2 + exit 1 +fi + +base_url="$1" +file_url="$2" +target_file="$3" +success=false + +rm -f "$target_file" + +for i in 1 2 3; do + echo "Authenticating for download ..." >&2 + curl -fsSL -A Mozilla "$base_url/cookie/init.js.php" > /dev/null + + echo "Downloading ..." >&2 + curl -fLC - --retry 5 --retry-delay 3 -A Mozilla -o "$target_file" "$file_url" + + echo "Checking ..." >&2 + if unzip -p "$target_file" >/dev/null 2>&1; then + success=true + break + fi + + if [ $i -lt 3 ]; then + rm -f "$target_file" + echo "Warning: invalid zip file - retrying." >&2 + else + echo "Error: invalid zip file." >&2 + fi +done + +[ "$success" = "true" ] && exit 0 || exit 1 |