aboutsummaryrefslogtreecommitdiff
path: root/contrib/verifybinaries/verify.sh
diff options
context:
space:
mode:
authorAndres G. Aragoneses <knocte@gmail.com>2017-04-25 17:40:09 +0800
committerAndres G. Aragoneses <knocte@gmail.com>2017-06-06 13:33:19 +0800
commit8d4dafd774436a355b6aa49a44b867cf78c38f6d (patch)
tree9319664f69980eb602de881b9587ee91864b91c3 /contrib/verifybinaries/verify.sh
parent9fec4da0bec93a49798b5f5e92cf76e900759ee4 (diff)
contrib/verifybinaries: allow filtering by platform
Downloading all the binaries of all platforms can take quite long, especially for slow connections, which may deter people from using this script and, therefore, to disregard security altogether. This change introduces the new possibility of specifying the platform along with the version number, so that only the binaries that contain the platform name are downloaded.
Diffstat (limited to 'contrib/verifybinaries/verify.sh')
-rwxr-xr-xcontrib/verifybinaries/verify.sh43
1 files changed, 38 insertions, 5 deletions
diff --git a/contrib/verifybinaries/verify.sh b/contrib/verifybinaries/verify.sh
index e20770c96a..c2cc2b7013 100755
--- a/contrib/verifybinaries/verify.sh
+++ b/contrib/verifybinaries/verify.sh
@@ -42,13 +42,36 @@ if [ -n "$1" ]; then
VERSION="$VERSIONPREFIX$1"
fi
- #now let's see if the version string contains "rc", and strip it off if it does
- # and simultaneously add RCSUBDIR to BASEDIR, where we will look for SIGNATUREFILENAME
- if [[ $VERSION == *"$RCVERSIONSTRING"* ]]; then
- BASEDIR="$BASEDIR${VERSION/%-$RCVERSIONSTRING*}/"
- BASEDIR="$BASEDIR$RCSUBDIR.$RCVERSIONSTRING${VERSION: -1}/"
+ STRIPPEDLAST="${VERSION%-*}"
+
+ #now let's see if the version string contains "rc" or a platform name (e.g. "osx")
+ if [[ "$STRIPPEDLAST-" == "$VERSIONPREFIX" ]]; then
+ BASEDIR="$BASEDIR$VERSION/"
else
+ # let's examine the last part to see if it's rc and/or platform name
+ STRIPPEDNEXTTOLAST="${STRIPPEDLAST%-*}"
+ if [[ "$STRIPPEDNEXTTOLAST-" == "$VERSIONPREFIX" ]]; then
+
+ LASTSUFFIX="${VERSION##*-}"
+ VERSION="$STRIPPEDLAST"
+
+ if [[ $LASTSUFFIX == *"$RCVERSIONSTRING"* ]]; then
+ RCVERSION="$LASTSUFFIX"
+ else
+ PLATFORM="$LASTSUFFIX"
+ fi
+
+ else
+ RCVERSION="${STRIPPEDLAST##*-}"
+ PLATFORM="${VERSION##*-}"
+
+ VERSION="$STRIPPEDNEXTTOLAST"
+ fi
+
BASEDIR="$BASEDIR$VERSION/"
+ if [[ $RCVERSION == *"$RCVERSIONSTRING"* ]]; then
+ BASEDIR="$BASEDIR$RCSUBDIR.$RCVERSION/"
+ fi
fi
SIGNATUREFILE="$BASEDIR$SIGNATUREFILENAME"
@@ -92,12 +115,22 @@ if [ $RET -ne 0 ]; then
exit "$RET"
fi
+if [ -n "$PLATFORM" ]; then
+ grep $PLATFORM $TMPFILE > "$TMPFILE-plat"
+ TMPFILESIZE=$(stat -c%s "$TMPFILE-plat")
+ if [ $TMPFILESIZE -eq 0 ]; then
+ echo "error: no files matched the platform specified" && exit 3
+ fi
+ mv "$TMPFILE-plat" $TMPFILE
+fi
+
#here we extract the filenames from the signature file
FILES=$(awk '{print $2}' "$TMPFILE")
#and download these one by one
for file in $FILES
do
+ echo "Downloading $file"
wget --quiet -N "$BASEDIR$file"
done