From e2ca8ecd1aee7242eb3d204aa7c8c9a77de0b5b0 Mon Sep 17 00:00:00 2001 From: oneyb Date: Sat, 23 Jun 2018 16:27:14 +0200 Subject: [PATCH 1/2] made it quicker to retry installation in case something goes wrong and remove the burden from the zotero server --- zotero_installer.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zotero_installer.sh b/zotero_installer.sh index af27aa5..c1e5298 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. @@ -74,7 +74,7 @@ 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!" From 8364f291c422f058477db99792a975aa24453394 Mon Sep 17 00:00:00 2001 From: oneyb Date: Thu, 28 Jun 2018 12:09:58 +0200 Subject: [PATCH 2/2] added file integrity checker depending on sha256 hashes --- zotero_installer.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zotero_installer.sh b/zotero_installer.sh index af27aa5..f5639a2 100755 --- a/zotero_installer.sh +++ b/zotero_installer.sh @@ -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 @@ -80,6 +82,14 @@ if [ $? -ne 0 ]; then 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?"