Skip to content

Instantly share code, notes, and snippets.

@lamafab
Last active January 8, 2020 16:33
Show Gist options
  • Save lamafab/5abaff261e92a2ff1e3c68c5eb2bd823 to your computer and use it in GitHub Desktop.
Save lamafab/5abaff261e92a2ff1e3c68c5eb2bd823 to your computer and use it in GitHub Desktop.
[W3F HQ] Script to update and run Polkadot
#!/bin/bash
# This script assumes that Polkadot is cloned in the relative path `polkadot/`
# and the file `run_kusama.sh` (which actually executes the program) is present.
#
# Example usage: `$ ./update_kusama.sh v0.7.15`
print_error () {
echo -e "\e[41m[!!]\e[0m Please specify a valid git tag"
echo "Example command:"
echo "$ ./update_kusama.sh v0.7.15"
exit 1
}
# Check if the git tag was set as an argument
if [ -z "$1" ]
then
print_error
fi
# Pull the newest releases
cd polkadot/
git checkout master
git pull origin master --tags
# Checkout the specified tag, exit if it does not exist
git checkout $1
if [ ! $? -eq 0 ]; then
echo ""
print_error
fi
# Finally build and execute
cargo build --release
cd ..
./run_kusama.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment