-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
60 lines (56 loc) · 2.3 KB
/
run.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
58
59
60
#!/bin/sh
echo "$PROVER_ID" > ~/.nexus/prover-id
rustc --version || curl https://sh.rustup.rs -sSf | sh
NEXUS_HOME=$HOME/.nexus
GREEN='\033[1;32m'
ORANGE='\033[1;33m'
NC='\033[0m' # No Color
while [ -z "$NONINTERACTIVE" ] && [ ! -f "$NEXUS_HOME/prover-id" ]; do
read -p "Do you agree to the Nexus Beta Terms of Use (https://nexus.xyz/terms-of-use)? (Y/n) " yn </dev/tty
case $yn in
[Nn]* ) exit;;
[Yy]* ) break;;
"" ) break;;
* ) echo "Please answer yes or no.";;
esac
done
git --version 2>&1 >/dev/null
GIT_IS_AVAILABLE=$?
if [ $GIT_IS_AVAILABLE != 0 ]; then
echo Unable to find git. Please install it and try again.
exit 1;
fi
PROVER_ID=$(cat $NEXUS_HOME/prover-id 2>/dev/null)
# Email verification prompt temporarily disabled
SKIP_EMAIL_VERIFICATION=1
if [ -z "$SKIP_EMAIL_VERIFICATION" ] && [ -z "$NONINTERACTIVE" ] && [ "${#PROVER_ID}" -ne "28" ]; then
echo "\nTo receive credit for proving in Nexus testnets..."
echo "\t1. Go to ${GREEN}https://beta.nexus.xyz${NC}"
echo "\t2. On the bottom left hand corner, copy the ${ORANGE}prover id${NC}"
echo "\t3. Paste the ${ORANGE}prover id${NC} here. Press Enter to continue.\n"
read -p "Enter your Prover Id (optional)> " PROVER_ID </dev/tty
while [ ! ${#PROVER_ID} -eq "0" ]; do
if [ ${#PROVER_ID} -eq "28" ]; then
if [ -f "$NEXUS_HOME/prover-id" ]; then
echo Copying $NEXUS_HOME/prover-id to $NEXUS_HOME/prover-id.bak
cp $NEXUS_HOME/prover-id $NEXUS_HOME/prover-id.bak
fi
echo "$PROVER_ID" > $NEXUS_HOME/prover-id
echo Prover id saved to $NEXUS_HOME/prover-id.
break;
else
echo Unable to validate $PROVER_ID. Please make sure the full prover id is copied.
fi
read -p "Prover Id (optional)> " PROVER_ID </dev/tty
done
fi
REPO_PATH=$NEXUS_HOME/network-api
# if [ -d "$REPO_PATH" ]; then
# echo "$REPO_PATH exists. Updating.";
# (cd $REPO_PATH && git stash save && git fetch --tags)
# else
# mkdir -p $NEXUS_HOME
# (cd $NEXUS_HOME && git clone https://github.com/nexus-xyz/network-api)
# fi
# (cd $REPO_PATH && git -c advice.detachedHead=false checkout $(git rev-list --tags --max-count=1))
(cd $REPO_PATH/clients/cli && cargo run --release --bin prover -- beta.orchestrator.nexus.xyz)