Skip to content

Instantly share code, notes, and snippets.

@kwunyeung
Created May 31, 2019 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwunyeung/2a45804885b87947683bda592762c64e to your computer and use it in GitHub Desktop.
Save kwunyeung/2a45804885b87947683bda592762c64e to your computer and use it in GitHub Desktop.
Upgrade IRISnet
#!/bin/bash
# Upgrade IRIS and restart gaiad
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-t|--tag)
TAG="$2"
shift # past argument
shift # past value
;;
--default)
DEFAULT=YES
shift # past argument
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
if [ -z "$TAG" ]; then
echo "Usage: iris_upgrade.sh -t v0.19.0"
exit 1
fi
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
# upgarde system packages
sudo apt upgrade -y
# install dep and statik
sudo apt install go-dep golang-statik -y
# get latest Cosmos SDK
go get github.com/irisnet/irishub
cd $GOPATH/src/github.com/irisnet/irishub
git fetch --all
git checkout -f $TAG
make install
echo ""
echo "IRIShub " $TAG "installed."
echo ""
# Log installed versions
echo "iris version :" $(iris version)
echo "iriscli version :" $(iriscli version)
cd
echo "Stopping iris"
sudo service iris stop
sudo cp go/bin/iris* /opt/go/bin/
echo "Starting iris"
sudo service iris start
echo "iris restarted."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment