From: Lucas Werkmeister Date: Wed, 17 Jan 2018 23:23:55 +0000 (+0100) Subject: chg: refactor script to fetch external libraries X-Git-Url: https://code.wpia.club/?p=gigi.git;a=commitdiff_plain;h=f895a1ab01c966aeeafe2c743120fdbc81618efa chg: refactor script to fetch external libraries With this formulation of the script, we only need to change one place in the script to update or add libraries. (However, the separate .gitignore and checksums.txt files still need to be updated as well.) (The unquoted $(basename ...) is safe because we know the basenames cannot contain spaces – at worst, they would be URL-encoded as %20.) Change-Id: I47ec8fcb1e1c581df52a9e31f726bcc35fe8f94b --- diff --git a/lib/external/fetch.sh b/lib/external/fetch.sh index 1a094d9c..c733449b 100755 --- a/lib/external/fetch.sh +++ b/lib/external/fetch.sh @@ -1,5 +1,9 @@ #!/bin/bash -wget -N "http://www.dnsjava.org/download/dnsjava-2.1.8.zip" "http://www.dnsjava.org/download/dnsjava-2.1.8.jar" +externals=( + 'http://www.dnsjava.org/download/dnsjava-2.1.8.zip' + 'http://www.dnsjava.org/download/dnsjava-2.1.8.jar' +) +wget -N "${externals[@]}" if ! sha256sum -c checksums.txt; then - rm -vf dnsjava-2.1.8.zip dnsjava-2.1.8.jar + rm -vf $(basename -a "${externals[@]}") fi