summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorBin Jin2021-06-01 00:31:16 +0800
committerBin Jin2021-06-01 00:31:16 +0800
commit88af53042ed77a17d9a6b13fd4225b1755d407a4 (patch)
treee8f7764f11f6bb49243336e63e72d873e492fed1 /PKGBUILD
parente9a12a65b610c9ae3f1e54ec4033b2b2a1a7b9ee (diff)
downloadaur-88af53042ed77a17d9a6b13fd4225b1755d407a4.tar.gz
fix large file download from Google Drive
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD24
1 files changed, 17 insertions, 7 deletions
diff --git a/PKGBUILD b/PKGBUILD
index e22db9c3c6c5..f018138c3daf 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,19 +6,29 @@ pkgdesc="Configuration tool for BLHeli_32 based ESCs"
arch=('x86_64')
url="https://github.com/bitdump/BLHeli/tree/master/BLHeli_32%20ARM"
-# Check Google Drive folder: https://drive.google.com/drive/folders/1Y1bUMnRRolmMD_lezL0FYd3aMBrNzCig
-GDRIVENAME="BLHeliSuite32xLinux64_1024.zip"
-GDRIVELINK="https://drive.google.com/file/d/1_At79E9t-X8fznPAXeIaDw8eTUxThpgg/view?usp=sharing"
-
-source=("$GDRIVENAME::https://drive.google.com/uc?export=download&id=$(echo "$GDRIVELINK" | cut -d'/' -f 6)")
-sha256sums=('db1b9ce374e2d8f913719500f38523bb151f9099acf0c59d7bb2d018296c6936')
-
options=(!strip)
license=('unknown')
depends=('libcurl-gnutls')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
+# Check Google Drive folder: https://drive.google.com/drive/folders/1Y1bUMnRRolmMD_lezL0FYd3aMBrNzCig
+# Right click the corresponding file and select "Copy Link" to obtain the sharing link.
+GDRIVENAME="BLHeliSuite32xLinux64_1024.zip"
+GDRIVELINK="https://drive.google.com/file/d/1_At79E9t-X8fznPAXeIaDw8eTUxThpgg/view?usp=sharing"
+
+# Files larger than 25MB requires confirmation key from cookie.
+GDRIVELINK="https://drive.google.com/uc?export=download&id=$(echo "$GDRIVELINK" | cut -d'/' -f 6)"
+CONFIRMKEY=$(/usr/bin/curl -c - -r 0-0 "$GDRIVELINK" --silent -o /dev/null | tee /tmp/bl32cookie | grep -F download_warning | head -n 1 | tr -d '[:space:]' | tail -c 4)
+
+if [ -n "$CONFIRMKEY" ] ; then
+ GDRIVELINK="$GDRIVELINK&confirm=$CONFIRMKEY"
+ DLAGENTS=('https::/usr/bin/curl -b /tmp/bl32cookie -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u')
+fi
+
+source=("$GDRIVENAME::$GDRIVELINK")
+sha256sums=('db1b9ce374e2d8f913719500f38523bb151f9099acf0c59d7bb2d018296c6936')
+
package() {
mkdir -p "${pkgdir}/opt/${_pkgname}"
mkdir -p "${pkgdir}/usr/bin"