erigon-pulse/cmd/downloader/torrent_hashes_update.sh

44 lines
1.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
datadir=$1
network=$2
2022-03-30 02:54:07 +00:00
if [ -z "$datadir" ]; then
2022-03-30 02:55:22 +00:00
echo "arguments: <your_datadir> <network_name>"
2022-03-30 02:54:07 +00:00
exit 1
fi
if [ -z "$network" ]; then
2022-03-30 02:55:22 +00:00
echo "arguments: <your_datadir> <network_name>"
2022-03-30 02:54:07 +00:00
exit 1
fi
#git reset --hard
#git checkout devel
#git pull
# clean
cd ./../erigon-snapshot
git reset --hard
2022-03-30 02:54:07 +00:00
git checkout auto
git pull --ff-only origin auto
cd ../erigon
# it will return only .seg of 500K (because Erigon send to Downloader only such files)
go run -trimpath ./cmd/downloader torrent_hashes --datadir="$datadir" --targetfile=./../erigon-snapshot/"$network".toml
cd ./../erigon-snapshot
git add "$network".toml
2022-03-30 02:54:07 +00:00
git commit -m "[ci]: $network, [from]: $HOSTNAME"
2022-04-02 06:20:26 +00:00
#GH_TOKEN=""
2022-03-30 02:54:07 +00:00
GH_TOKEN_FILE=""
2022-04-02 06:20:26 +00:00
if [ ! type gcloud ] &>/dev/null; then
# GH_TOKEN=$(gcloud secrets versions access 1 --secret="github-snapshot-push")
GH_TOKEN_FILE="~/.ssh/vm_rsa"
2022-03-30 02:54:07 +00:00
fi
2022-03-30 02:54:07 +00:00
# /dev/null to avoid logging of insecure git output
#SSH_CMD='echo ${GH_TOKEN} | ssh -i /dev/stdin -o IdentitiesOnly=yes'
SSH_CMD="ssh -i ${GH_TOKEN_FILE} -o IdentitiesOnly=yes"
2022-04-02 06:20:26 +00:00
GIT_SSH_COMMAND=${SSH_CMD} git push git@github.com:ledgerwatch/erigon-snapshot.git auto >/dev/null 2>&1
echo "Done"