diff --git a/tag.sh b/tag.sh new file mode 100644 index 0000000..8bd0cab --- /dev/null +++ b/tag.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# logging +exec > >(tee -i /home/ubuntu/logs/tag.log) +exec 2>&1 + +# update repo +echo "Updating repo" +cd /home/ubuntu/wownero +git checkout . +git rm -rf /home/ubuntu/wownero/build +git fetch --all +git pull + +# checkpoint +/home/ubuntu/utilities/wownerod status +echo "Checkpointing" +height=$(curl -s http://127.0.0.1:34568/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_info"}' -H 'Content-Type: application/json' | jq -r '.result.height') +echo "Starting height: $height" +declare -i value +value=$height-60 +echo "Roll back 60 blocks. New height: $value" +sha1=$(sha256sum /home/ubuntu/wownero/src/blocks/checkpoints.dat | awk '{print $1}') +echo "Old SHA-256: $sha1" +rm -rf /home/wownero/src/blocks/checkpoints.dat +/home/ubuntu/utilities/wownero-blockchain-export --blocksdat --block-stop $value --output-file /home/ubuntu/wownero/src/blocks/checkpoints.dat & +sleep 20s +sha2=$(sha256sum /home/ubuntu/wownero/src/blocks/checkpoints.dat | awk '{print $1}') +echo "New SHA-256: $sha2" +sed -i "s/$sha1/$sha2/g" /home/ubuntu/wownero/src/cryptonote_core/blockchain.cpp +git status +git diff + +# build Wownero +echo "Building Wownero" +USE_SINGLE_BUILDDIR=1 make -j3 release-static-linux-x86_64 + +# archive binaries +echo "taring the binaries" +cd /home/ubuntu/wownero/build/release/bin +tar -cvjSf wownero_Linux_$value.tar.bz2 * +sha256sum /home/ubuntu/wownero/build/release/bin/wownero_Linux_$value.tar.bz2 + +# copy archive file to release folder +echo "moving tar file to release folder" +mv /home/ubuntu/wownero/build/release/bin/wownero_Linux_$value.tar.bz2 /home/ubuntu/release/wownero_Linux_$value.tar.bz2 +sha256sum /home/ubuntu/release/wownero_Linux_$value.tar.bz2 +echo "done"