Skip to content

Instantly share code, notes, and snippets.

@nxt-ext
Last active August 29, 2015 13:57
Show Gist options
  • Save nxt-ext/9387553 to your computer and use it in GitHub Desktop.
Save nxt-ext/9387553 to your computer and use it in GitHub Desktop.
Nxt dowloader and verifier
#!/bin/bash
# This is free and unencumbered script released into the public domain.
# Made by EmoneyRu (https://github.com/nxt-ext/nxt-kit#contacts) NXT-9XEN-PLLG-RUW8-2H7SV
if [[ -z "$1" ]]; then
echo "Pass version number as first parameter"
exit 1
fi
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin;
gpg --recv-keys 0xFF2A19FA > /dev/null 2>&1 || { echo "Could not recieve public key for file verification. Exiting."; exit 1; }
mkdir -p distrib && cd $_
rm -f nxt-client-$1.*
wget -nv https://bitbucket.org/JeanLucPicard/nxt/downloads/nxt-client-$1.{zip,zip.asc,changelog.txt.asc} > /dev/null 2>&1
zip_sig=$(gpg --verify nxt-client-$1.zip.asc > /dev/null 2>&1; echo $?)
chg_sig=$(gpg --verify nxt-client-$1.changelog.txt.asc > /dev/null 2>&1; echo $?)
sha_sum=$(sha256sum -c nxt-client-$1.changelog.txt.asc > /dev/null 2>&1; echo $?)
if [[ sha_sum -ne 0 || zip_sig -ne 0 || chg_sig -ne 0 ]]; then
rm -f nxt-client-$1.*
echo "ERROR: Signature mismatch."
exit 1
else
ln -sf nxt-client-$1.zip nxt.zip
echo "OK"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment