#!/bin/bash RNODE_VERSION=0.7.1 RELEASE_URL="https://github.com/rchain/rchain/releases/download" PYR8_URL="https://repo.pyr8.io/rchain/downloads" exit() { echo "Goodbye!" break } install() { rm -rf $HOME/rnode-*.tgz* rm -rf $HOME/.rnode rm -rf $HOME/rnode if wget -P $HOME $1; then tar -xzvf $HOME/rnode-$RNODE_VERSION.tgz mv $HOME/rnode-$RNODE_VERSION $HOME/rnode rm -rf $HOME/rnode-$RNODE_VERSION.tgz echo "RNode successfully installed." else echo "Failed to download RNode." fi exit } POSITIONAL=() while [[ $# -gt 0 ]] do key="$1" case $key in -v|--version) RNODE_VERSION="$2" shift shift ;; *) echo "Unknown option ignored: $1 $2" shift shift ;; esac done echo "Using RNode version: $RNODE_VERSION. Please run the script with the -v option if you wish to specify a different version." PS3='Please enter your choice: ' options=("Release" "Master" "Dev" "Testing" "Quit") select opt in "${options[@]}" do case $opt in "Release") echo "you chose choice $REPLY which is $opt" install ${RELEASE_URL}/v$RNODE_VERSION/rnode-$RNODE_VERSION.tgz ;; "Master") echo "you chose choice $REPLY which is $opt" install ${PYR8_URL}/master/rnode-$RNODE_VERSION.tgz ;; "Dev") echo "you chose choice $REPLY which is $opt" install ${PYR8_URL}/dev/rnode-$RNODE_VERSION.tgz ;; "Testing") echo "you chose choice $REPLY which is $opt" install ${PYR8_URL}/testing/rnode-$RNODE_VERSION.tgz ;; "Quit") exit ;; *) echo "invalid option $REPLY";; esac done