2024-04-21 12:06:41 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Install dependent libraries
|
|
|
|
go version 2>/dev/null || sudo snap install go --classic
|
|
|
|
jq --version 2>/dev/null || sudo snap install jq
|
|
|
|
make --version 2>/dev/null || sudo apt install make -y
|
|
|
|
gcc --version 2>/dev/null || (sudo apt-get update; sudo apt install gcc -y)
|
|
|
|
|
|
|
|
# Build binary
|
|
|
|
export PATH=$PATH:$(go env GOPATH)/bin
|
2024-05-01 08:11:39 +00:00
|
|
|
0gchaind version 2>/dev/null
|
2024-04-21 12:06:41 +00:00
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
# Make under root dir
|
|
|
|
SCRIPT_DIR=`dirname "${BASH_SOURCE[0]}"`
|
|
|
|
cd $SCRIPT_DIR/../..
|
2024-06-21 01:42:33 +00:00
|
|
|
rm -rf $(go env GOPATH)/bin/0gchaind
|
2024-04-21 12:06:41 +00:00
|
|
|
make install
|
|
|
|
|
|
|
|
# Add gopath to path
|
|
|
|
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.profile
|
|
|
|
fi
|