diff --git a/zotero_installer.sh b/zotero_installer.sh index af27aa5..38ba1fa 100755 --- a/zotero_installer.sh +++ b/zotero_installer.sh @@ -1,7 +1,7 @@ #!/bin/bash # # Zotero installer -# Copyright 2011-2013 Sebastiaan Mathot +# Copyright 2011-2018 Sebastiaan Mathot # # # This file is part of qnotero. @@ -22,8 +22,10 @@ VERSION="5.0.48" if [ `uname -m` == "x86_64" ]; then ARCH="x86_64" + VERSION_SHA256_HASH=7cb871894f1de168c0e486d2d48fc8524d23453198a2b834c23d958abd63443d else ARCH="i686" + VERSION_SHA256_HASH=24f66641bc0bebc9e7e1414bdb03050e6fde7d6939307b17afc3d1f349d5646d fi TMP="/tmp/zotero.tar.bz2" DEST_FOLDER=zotero @@ -74,12 +76,20 @@ URL="https://download.zotero.org/client/release/${VERSION}/Zotero-${VERSION}_lin echo ">>> Downloading Zotero standalone $VERSION for $ARCH" echo ">>> URL: $URL" -wget $URL -O $TMP +[[ ! -f $TMP ]] && wget $URL -O $TMP if [ $? -ne 0 ]; then echo ">>> Failed to download Zotero" echo ">>> Aborting installation, sorry!" exit 1 fi +# Check integrity + +NEW_HASH=$(sha256sum $TMP | awk '{print $1}') +if [ $VERSION_SHA256_HASH != $NEW_HASH ]; then + echo ">>> Zotero download file corrupted" + echo ">>> Aborting installation, sorry!" + exit 1 +fi if [ -d $DEST/$DEST_FOLDER ]; then echo ">>> The destination folder ($DEST/$DEST_FOLDER) exists. Do you want to remove it?"