diff options
author | archibald869 | 2019-04-16 14:44:53 +0200 |
---|---|---|
committer | archibald869 | 2019-04-16 14:44:53 +0200 |
commit | 93234c8e390a8f036c06b9f3490f51a26578774e (patch) | |
tree | 52db58b61a60cc7d14be4f43139817dd7d300e7e | |
parent | 92c71af2773b318852f9afe577a4860577f79338 (diff) | |
download | aur-93234c8e390a8f036c06b9f3490f51a26578774e.tar.gz |
Use separate script as download agent
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 11 | ||||
-rwxr-xr-x | dlagent | 37 |
3 files changed, 44 insertions, 8 deletions
@@ -1,7 +1,7 @@ pkgbase = freefilesync-bin pkgdesc = Folder comparison and synchronization pkgver = 10.11 - pkgrel = 1 + pkgrel = 2 url = https://freefilesync.org arch = i686 arch = x86_64 @@ -19,11 +19,13 @@ pkgbase = freefilesync-bin source = FreeFileSync.png source = RealTimeSync.desktop source = RealTimeSync.png + source = dlagent sha256sums = c71f821909e79baa03fc175b20c50f4f5a21b8fc4d638391dcaa6e0f00ffff85 sha256sums = d46ae777a53c6e1d8e4baa088af4ad2eb798ff9064c2b4bc3768b7192d400eea sha256sums = b2fac3b8c0badfbbbcf605ecad5b184f2c9918bd0dd14596e6c43df3f2a76a30 sha256sums = 11315b1735c4f6af91f3aaaf3b37800c54ce24f10a3e674d94f88048605e4da8 sha256sums = 23c68af45d34f41fdb76886067b71af4dd3fe14f2dd60f73193b2052dc333bf6 + sha256sums = 5d8f35705d97e2099f4c8f8a26cb4091cea651f493e5317c82fd53e01e3c1d48 pkgname = freefilesync-bin @@ -3,7 +3,7 @@ pkgname=freefilesync-bin _pkgname=freefilesync pkgver=10.11 -pkgrel=1 +pkgrel=2 pkgdesc="Folder comparison and synchronization" arch=("i686" "x86_64") url="https://freefilesync.org" @@ -17,6 +17,7 @@ source=( FreeFileSync.png RealTimeSync.desktop RealTimeSync.png + dlagent ) sha256sums=( "c71f821909e79baa03fc175b20c50f4f5a21b8fc4d638391dcaa6e0f00ffff85" @@ -24,14 +25,10 @@ sha256sums=( "b2fac3b8c0badfbbbcf605ecad5b184f2c9918bd0dd14596e6c43df3f2a76a30" "11315b1735c4f6af91f3aaaf3b37800c54ce24f10a3e674d94f88048605e4da8" "23c68af45d34f41fdb76886067b71af4dd3fe14f2dd60f73193b2052dc333bf6" + "5d8f35705d97e2099f4c8f8a26cb4091cea651f493e5317c82fd53e01e3c1d48" ) options=(!strip) -DLAGENTS=("https::/usr/bin/curl -fLC - --retry 5 --retry-delay 3 -A Mozilla -o %o %u") - -_auth_request="$(\ - echo "Authenticating for download ..." >&2; \ - /usr/bin/curl -fsSL -A Mozilla "$url/cookie/load-consent.php" \ -)" +DLAGENTS=("https::./dlagent $url %u %o") package() { _pkg=FreeFileSync diff --git a/dlagent b/dlagent new file mode 100755 index 000000000000..93622375622a --- /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/load-consent.php" > /dev/null + + echo "Downloading ..." >&2 + curl -fLC - --retry 5 --retry-delay 3 -A Mozilla -o "$target_file" "$file_url" + + echo "Checking ..." >&2 + if gunzip -c "$target_file" | tar t > /dev/null; then + success=true + break + fi + + if [ $i -lt 3 ]; then + rm -f "$target_file" + echo "Warning: invalid tarball - retrying." >&2 + else + echo "Error: invalid tarball." >&2 + fi +done + +[ "$success" = "true" ] && exit 0 || exit 1 |