Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
script to upgrade the Cosmos gaia testnet
# Upgrade Cosmos SDK and restart gaiad
while [[ $# -gt 0 ]]
case $key in
shift # past argument
shift # past value
shift # past argument
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
set -- "${POSITIONAL[@]}" # restore positional parameters
if [ -z "$TAG" ]; then
echo "Usage: -t v0.19.0"
exit 1
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
cd $GOPATH/src/
git fetch --all
git checkout -f $TAG
make clean && make install
echo ""
echo "Cosmos SDK " $TAG "installed."
echo ""
# Log installed versions
echo "gaiad version :" $(gaiad version)
echo "gaiacli version :" $(gaiacli version)
echo "Stopping gaiad"
sudo service gaiad stop
sudo cp go/bin/gaia* /opt/go/bin/
echo "Starting gaiad"
sudo service gaiad start
echo "gaiad restarted."

This comment has been minimized.

Copy link

chris-remus commented Jul 14, 2018

A couple updates -

Update line 28 to v0.21.0

To fix -

make install error

make install
go install -tags netgo -ldflags “-X” ./cmd/gaia/cmd/gaiad
exec: “gcc”: executable file not found in $PATH
Makefile:40: recipe for target ‘install’ failed
make: *** [install] Error 2
just need
apt-get install build-essential

then run
make install


This comment has been minimized.

Copy link
Owner Author

kwunyeung commented Jul 14, 2018

Line 28 is only an example of the usage of this script. build-essential only need to install if gcc is not available. It should not be in the upgrade script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.