-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.sh
More file actions
108 lines (94 loc) · 2.4 KB
/
Copy pathinit.sh
File metadata and controls
108 lines (94 loc) · 2.4 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
if ! command -v go &> /dev/null
then
echo "go could not be found. Please install it first"
exit
fi
# Check the go version
ver=$(go version | { read _ _ v _; echo ${v#go}; })
subver=$(echo $ver | cut -d'.' -f2)
if [[ $subver -lt 18 ]]; then
echo "Your go version is v$ver, please upgrade to at least v1.18.0 first"
exit;
fi
shopt -s expand_aliases
_xtrace() {
case $1 in
on) set -x ;;
off) set +x ;;
esac
}
alias xtrace='{ _xtrace $(cat); } 2>/dev/null <<<'
# Backup the zond wallet.json file from accidental deletion
if [ -f ~/zond/wallet.json ]; then
walletbackup='wallet.backup.json'
if [ -f $walletbackup ]; then
walletbackup=wallet.backup.$(date +'%s').json
fi
xtrace on
cp ~/zond/wallet.json ~/$walletbackup
xtrace off
echo "... Backed up wallet to ~/$walletbackup"
fi
if [ -d ~/.zond/ ]; then
echo -e "\nDo you wish remove your ~/.zond/ directory (keeps state)?"
select yn in "Yes" "No"; do
case $yn in
Yes )
xtrace on
rm -rf ~/.zond
xtrace off
echo "... Removed ~/.zond/ directories";
break;;
No )
echo "... Keeping zond state files (~/.zond)"
break;;
esac
done
fi
if [ -d ~/zond/ ]; then
echo -e "\nDo you want to replace the ~/zond/ directory?"
select yn in "Yes" "No"; do
case $yn in
Yes )
xtrace on
rm -rf ~/zond/
git clone https://github.com/theQRL/zond ~/zond
xtrace off
echo "... Replaced the ~/zond/ directory";
break;;
No )
echo "... Keeping zond directory (~/zond)"
break;;
esac
done
else
git clone https://github.com/theQRL/zond ~/zond
fi
if [ -n "$walletname" ]; then
if [ ! -f ~/zond/wallet.json ]; then
echo "Copying backed up wallet file $walletbackup to ~/zond/wallet.json"
cp $walletbackup ~/zond/wallet.json
fi
fi
cd ~/zond
go build ~/zond/cmd/gzond
go build ~/zond/cmd/zond-cli
echo -e "\nWould you like to run ./gzond in the background?"
select yn in "Yes" "No"; do
case $yn in
Yes )
xtrace on
screen -XS zond quit
screen -S zond -dm ./gzond
xtrace off
break;;
No ) exit;;
esac
done
cat << EOF
Congratulations, now have a node setup. So, where to go from here?
- Play with the zond-cli (it's in ~/zond/)
- Read the Zond documentation: https://zond-docs.theqrl.org
- Join the Hackathon: https://www.theqrl.org/events/qrl-hackathon-2022/
EOF