Skip to content

Instantly share code, notes, and snippets.

@michalisFr
Last active January 22, 2023 16:57
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michalisFr/daa01c7374793a684a3a1f61e4959492 to your computer and use it in GitHub Desktop.
Save michalisFr/daa01c7374793a684a3a1f61e4959492 to your computer and use it in GitHub Desktop.
Polkadot node update script
#! /bin/bash
wget https://github.com/paritytech/polkadot/releases/download/v$1/polkadot && \
wget https://github.com/paritytech/polkadot/releases/download/v$1/polkadot.sha256 && \
sed -i 's+./artifacts/polkadot+polkadot+g' polkadot.sha256
if sha256sum -c polkadot.sha256 2>&1 | grep -q 'OK'
then
echo "** SHA256 matches **"
chmod +x polkadot && \
sudo chown polkadot:polkadot polkadot && \
sudo systemctl stop polkadot.service && \
sudo mv polkadot /usr/local/bin/polkadot && \
rm polkadot.sha256 && \
sudo systemctl start polkadot.service && \
sudo journalctl -f -u polkadot.service
else
echo "** SHA256 doesn't match. Aborting **"
rm polkadot*
fi
echo done!
@michalisFr
Copy link
Author

Usage: ./update_node <version> (without the v in version). Example: ./update_node 0.9.8
polkadot: User running the service (change accordingly in chown polkadot:polkadot)
polkadot.service: Service name (change accordingly in all instances)
The last line journalctl will run the service logs to check the update has been successful. Exit with Ctrl+C

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment