forked from KaneoHunter/Bulwark-Staking-Install
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrefresh.sh
57 lines (39 loc) · 1.67 KB
/
refresh.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# Install curl before we do anything else
echo "Installing curl and jq..."
sudo apt-get install -y curl jq
BOOTSTRAPURL=$(curl -s https://api.github.com/repos/bulwark-crypto/bulwark/releases/latest | grep bootstrap.dat.xz | grep browser_download_url | cut -d '"' -f 4)
BOOTSTRAPARCHIVE="bootstrap.dat.xz"
# Make sure curl and jq are installed
apt -qqy install curl jq
clear
clear
echo "This script will refresh your wallet."
read -pr "Press Ctrl-C to abort or any other key to continue. " -n1 -s
clear
USER=bulwark
USERHOME=/home/bulwark
sudo systemctl stop bulwarkd
echo "Refreshing node, please wait."
sleep 5
sudo rm -Rf "$USERHOME/.bulwark/blocks"
sudo rm -Rf "$USERHOME/.bulwark/database"
sudo rm -Rf "$USERHOME/.bulwark/chainstate"
sudo rm -Rf "$USERHOME/.bulwark/peers.dat"
sudo cp "$USERHOME/.bulwark/bulwark.conf" "$USERHOME/.bulwark/bulwark.conf.backup"
sudo sed -i '/^addnode/d' "$USERHOME/.bulwark/bulwark.conf"
echo "Installing bootstrap file..."
wget "$BOOTSTRAPURL" && sudo xz -d $BOOTSTRAPARCHIVE && sudo mv "./bootstrap.dat" "$USERHOME/.bulwark/bootstrap.dat" && rm $BOOTSTRAPARCHIVE
sudo systemctl start bulwarkd
clear
echo "Your wallet is syncing. Please wait for this process to finish."
echo "This can take up to a few hours. Do not close this window." && echo ""
until [ -n "$(bulwark-cli getconnectioncount 2>/dev/null)" ]; do
sleep 1
done
until sudo su -c "bulwark-cli mnsync status 2>/dev/null" bulwark | jq '.IsBlockchainSynced' | grep -q true; do
echo -ne "Current block: $(sudo su -c "bulwark-cli getinfo" bulwark | jq '.blocks')\\r"
sleep 1
done
clear
echo "" && echo "Wallet refresh completed. Do not forget to unlock your wallet!" && echo ""