summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Henrik Bruhn2020-11-15 11:34:30 +0100
committerJan-Henrik Bruhn2020-11-15 11:34:30 +0100
commited5f41d9251015ef2c8c0551c292e3f954a46813 (patch)
treeebf342cf100e3003d07de85e7d2bb91f99ddfbc7
parent0ab0f694ff8d68eddcad9b3204485412e1d109dd (diff)
downloadaur-ed5f41d9251015ef2c8c0551c292e3f954a46813.tar.gz
Better downloading of files
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD17
2 files changed, 10 insertions, 9 deletions
diff --git a/.SRCINFO b/.SRCINFO
index c8642654a93c..459ca688dfee 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = ltspice
pkgdesc = SPICE simulator, schematic capture and waveform viewer. Installation based on Field Update Utility.
pkgver = 17.20201112.2
- pkgrel = 1
+ pkgrel = 2
url = http://www.linear.com/designtools/software/
arch = x86_64
license = custom
diff --git a/PKGBUILD b/PKGBUILD
index 860d6a200cb5..a0ae1a15c05c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,7 +6,7 @@ _ltspice_ver="17"
pkgname=ltspice
pkgver=17.20201112.2
-pkgrel=1
+pkgrel=2
pkgdesc="SPICE simulator, schematic capture and waveform viewer. Installation based on Field Update Utility."
arch=('x86_64')
url="http://www.linear.com/designtools/software/"
@@ -27,7 +27,7 @@ _download_file() {
_download=true
# check whether cached file with correct CRC exists
- if [ -f "$pkgname/$file" ]; then
+ if [ -s "$pkgname/$file" ]; then
f_crc=$(cksfv -c "$pkgname/$file" | sed '/^;/d' | awk '{print $2}')
if [ "$crc" = "$f_crc" ]; then
_download=false
@@ -39,19 +39,20 @@ _download_file() {
mkdir -p "${pkgname}/$(dirname $file)"
# first try compressed path and decompress
- compressed_found=false
url="${_update_url}${file}.gz"
+ output="$pkgname/$file"
compressed="${pkgname}/${file}.gz"
curl -f $_curl_opts $url -o $compressed || true
- if [ -f "$compressed" ]; then
- cat $compressed | gunzip > $pkgname/$file
+ if [ -s "$compressed" ]; then
+ echo "Compressed found! $output"
+ cat $compressed | gunzip > $output
rm $compressed
- compressed_found=true
fi
# download uncompressed file if compressed was not found
- if [ "$compressed_found" = false ]; then
+ if [ ! -s "$output" ]; then
+ echo "no compressed: $output"
url="${_update_url}${file}"
- curl $_curl_opts $url -o "$pkgname/$file"
+ curl $_curl_opts $url > $output
fi
fi