diff options
author | Jan-Henrik Bruhn | 2020-11-15 11:34:30 +0100 |
---|---|---|
committer | Jan-Henrik Bruhn | 2020-11-15 11:34:30 +0100 |
commit | ed5f41d9251015ef2c8c0551c292e3f954a46813 (patch) | |
tree | ebf342cf100e3003d07de85e7d2bb91f99ddfbc7 | |
parent | 0ab0f694ff8d68eddcad9b3204485412e1d109dd (diff) | |
download | aur-ed5f41d9251015ef2c8c0551c292e3f954a46813.tar.gz |
Better downloading of files
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 17 |
2 files changed, 10 insertions, 9 deletions
@@ -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 @@ -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 |