diff --git a/clients/cli/README.md b/clients/cli/README.md index 05e5067..e86802c 100644 --- a/clients/cli/README.md +++ b/clients/cli/README.md @@ -5,7 +5,7 @@ Command line interface (CLI) for accessing the Nexus Network. Highest-performanc ## Quick start ``` -curl https://network-cli.nexus.xyz/install.sh | sh +curl https://cli.nexus.xyz/install.sh | sh ``` If you do not already have Rust, you will be prompted to install it. @@ -15,7 +15,7 @@ If you do not already have Rust, you will be prompted to install it. Use of the CLI is subject to the [Terms of Use](https://nexus.xyz/terms_of_use). The first time you run it, it prompts you to accept the terms. To accept the terms noninteractively (for example, in a continuous integration environment), -add `NONINTERACTIVE=1` at the start of the command. +add `NONINTERACTIVE=1` before `sh`. ## Known issues diff --git a/clients/cli/src/prover.rs b/clients/cli/src/prover.rs index 6de1cff..7933584 100644 --- a/clients/cli/src/prover.rs +++ b/clients/cli/src/prover.rs @@ -74,19 +74,6 @@ async fn main() { // If the prover_id file is found, use the contents, otherwise generate a new random id // and store it. - let _ = match env::var("NONINTERACTIVE") { - Ok(_) => (), - Err(_) => { - println!( - "Do you agree to the Nexus Beta Terms of Use (https://nexus.xyz/terms-of-use)? (Y/n)" - ); - let mut input = String::new(); - let _ = std::io::stdin().read_line(&mut input); - if input.chars().nth(0).unwrap() == 'n' || input.chars().nth(0).unwrap() == 'N' { - return (); - } - } - }; let mut prover_id = format!( "{}-{}-{}", random_word::gen(Lang::En), diff --git a/public/install.sh b/public/install.sh index d9c27bc..3cc94a6 100755 --- a/public/install.sh +++ b/public/install.sh @@ -2,18 +2,30 @@ rustc --version || curl https://sh.rustup.rs -sSf | sh NEXUS_HOME=$HOME/.nexus -CLI_ZIP=/tmp/nexus-network-api.zip -curl -L --verbose "https://docs.google.com/uc?export=download&id=1kcbEeKpVEyvIqL-_cgR5sYdZe_fOEPs6" > $CLI_ZIP -if [ -d "$NEXUS_HOME" ]; then - echo "$NEXUS_HOME exists. Updating."; - (cd $NEXUS_HOME && rm -rf network-api && unzip $CLI_ZIP) - # TODO: Once GitHub repo is public, do this instead - # (cd $NEXUS_HOME && git pull) + +while [ -z "$NONINTERACTIVE" ]; do + read -p "Do you agree to the Nexus Beta Terms of Use (https://nexus.xyz/terms-of-use)? (Y/n) " yn &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 + +if [ -d "$NEXUS_HOME/network-api" ]; then + echo "$NEXUS_HOME/network-api exists. Updating."; + (cd $NEXUS_HOME/network-api && git pull) else - # TODO: Once GitHub repo is public, do this instead - # git clone git@github.com:nexus-xyz/network-cli $NEXUS_HOME mkdir -p $NEXUS_HOME - (cd $NEXUS_HOME && unzip $CLI_ZIP) + (cd $NEXUS_HOME && git clone git@github.com:nexus-xyz/network-cli) fi (cd $NEXUS_HOME/network-api/clients/cli && cargo run --release --bin prover -- beta.orchestrator.nexus.xyz)