From 3273ac3e5b590fc43ba35eea6533a1a79162d463 Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Thu, 4 Feb 2016 21:34:21 +0000 Subject: [PATCH 01/36] fixed a conditional --- install-deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-deps.sh b/install-deps.sh index 1e1ce9128..a831bb64f 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -548,7 +548,7 @@ function run_installer() function linux_rocksdb_installer() { - if [[ $isUbuntu1404 ]]; then + if [[ $isUbuntu1404 == true ]]; then ubuntu1404_rocksdb_installer else oldpwd=`pwd` From 6af69d705766fe3ce08b2ad0b1643d15046c5c18 Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Thu, 4 Feb 2016 22:40:19 +0000 Subject: [PATCH 02/36] moved parity-related build stuff from install-deps into install-parity --- install-deps.sh | 97 ------------- install-parity.sh | 337 ++++++++++------------------------------------ 2 files changed, 70 insertions(+), 364 deletions(-) diff --git a/install-deps.sh b/install-deps.sh index 5c42bcf2a..a641f3659 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -636,89 +636,6 @@ function run_installer() fi } - function build_parity() - { - info "Downloading Parity..." - git clone git@github.com:ethcore/parity - cd parity - git submodule init - git submodule update - - info "Building & testing Parity..." - cargo test --release -p ethcore-util - - info "Running consensus tests..." - cargo test --release --features ethcore/json-tests -p ethcore - - echo - info "Parity source code is in $(pwd)/parity" - info "Run a client with: ${b}cargo run --release${reset}" - } - - function install_netstats() - { - echo "Installing netstats" - - secret=$(prompt_for_input "Please enter the netstats secret:") - instance_name=$(prompt_for_input "Please enter your instance name:") - contact_details=$(prompt_for_input "Please enter your contact details (optional):") - - # install ethereum & install dependencies - sudo apt-get install -y -qq build-essential git unzip wget nodejs npm ntp cloud-utils - - # add node symlink if it doesn't exist - [[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node - - # set up time update cronjob - sudo bash -c "cat > /etc/cron.hourly/ntpdate << EOF - #!/bin/sh - pm2 flush - sudo service ntp stop - sudo ntpdate -s ntp.ubuntu.com - sudo service ntp start - EOF" - - sudo chmod 755 /etc/cron.hourly/ntpdate - - [ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api netstats - cd netstats - git pull - git checkout 95d595258239a0fdf56b97dedcfb2be62f6170e6 - - sudo npm install - sudo npm install pm2 -g - - cat > app.json << EOL -[ - { - "name" : "node-app", - "script" : "app.js", - "log_date_format" : "YYYY-MM-DD HH:mm Z", - "merge_logs" : false, - "watch" : false, - "max_restarts" : 10, - "exec_interpreter" : "node", - "exec_mode" : "fork_mode", - "env": - { - "NODE_ENV" : "production", - "RPC_HOST" : "localhost", - "RPC_PORT" : "8545", - "LISTENING_PORT" : "30303", - "INSTANCE_NAME" : "${instance_name}", - "CONTACT_DETAILS" : "${contact_details}", - "WS_SERVER" : "wss://rpc.ethstats.net", - "WS_SECRET" : "${secret}", - "VERBOSITY" : 2 - - } - } -] -EOL - - pm2 start app.json - cd .. - } function abortInstall() { @@ -766,20 +683,6 @@ EOL # Check installation verify_installation - if [[ ! -e parity ]]; then - # Maybe install parity - if wait_for_user "${b}Build dependencies installed B-)!${reset} Would you like to download and build parity?"; then - # Do get parity. - build_parity - fi - fi - - if [[ $OS_TYPE == "linux" && $DISTRIB_ID == "Ubuntu" ]]; then - if wait_for_user "${b}Netstats:${reset} Would you like to install and configure a netstats client?"; then - install_netstats - fi - fi - # Display goodby message finish } diff --git a/install-parity.sh b/install-parity.sh index 3217cc284..9c0a40181 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -1,8 +1,7 @@ #!/usr/bin/env bash - -PARITY_DEB_URL=https://github.com/ethcore/parity/releases/download/beta-0.9/parity_0.9.0-0_amd64.deb +GET_DEPS_URL=https://raw.githubusercontent.com/ethcore/parity/install-parity/install-deps.sh?token=ABG4GdRAtO16t1U9l7JJgMDhf92CzHBWks5WvP6qwA%3D%3D function run_installer() { @@ -119,82 +118,38 @@ function run_installer() done } + function linux_version() + { + source /etc/lsb-release + + if [[ $DISTRIB_ID == "Ubuntu" ]]; then + if [[ $DISTRIB_RELEASE == "14.04" ]]; then + check "Ubuntu-14.04" + isUbuntu1404=true + else + check "Ubuntu, but not 14.04" + isUbuntu1404=false + fi + else + check "Ubuntu not found" + isUbuntu1404=false + fi + } function detectOS() { if [[ "$OSTYPE" == "linux-gnu" ]] then OS_TYPE="linux" - get_linux_dependencies + linux_version elif [[ "$OSTYPE" == "darwin"* ]] then OS_TYPE="osx" - get_osx_dependencies else OS_TYPE="win" abortInstall "${red}==>${reset} ${b}OS not supported:${reset} parity one-liner currently support OS X and Linux.\nFor instructions on installing parity on other platforms please visit ${u}${blue}http://ethcore.io/${reset}" fi echo - - if [[ $depCount == $depFound ]] - then - green "Found all dependencies ($depFound/$depCount)" - else - if [[ $canContinue == true ]] - then - red "Some dependencies are missing ($depFound/$depCount)" - elif [[ $canContinue == false && $depFound == 0 ]] - then - red "All dependencies are missing and cannot be auto-installed ($depFound/$depCount)" - abortInstall "$errorMessages"; - elif [[ $canContinue == false ]] - then - red "Some dependencies which cannot be auto-installed are missing ($depFound/$depCount)" - abortInstall "$errorMessages"; - fi - fi - } - - function get_osx_dependencies() - { - macos_version - find_git - find_ruby - find_brew - } - - function macos_version() - { - declare -a reqVersion - declare -a localVersion - - depCount=$((depCount+1)) - OSX_VERSION=`/usr/bin/sw_vers -productVersion 2>/dev/null` - - if [ -z "$OSX_VERSION" ] - then - uncheck "OS X version not supported 🔥" - isOsVersion=false - canContinue=false - else - IFS='.' read -a localVersion <<< "$OSX_VERSION" - IFS='.' read -a reqVersion <<< "$OSX_REQUIERED_VERSION" - - if (( ${reqVersion[0]} <= ${localVersion[0]} )) && (( ${reqVersion[1]} <= ${localVersion[1]} )) - then - check "OS X Version ${OSX_VERSION}" - isOsVersion=true - depFound=$((depFound+1)) - return - else - uncheck "OS X version not supported" - isOsVersion=false - canContinue=false - fi - fi - - errorMessages+="${red}==>${reset} ${b}Mac OS version too old:${reset} eth requires OS X version ${red}$OSX_REQUIERED_VERSION${reset} at least in order to run.\n" - errorMessages+=" Please update the OS and reload the install process.\n" } function find_eth() @@ -211,119 +166,8 @@ function run_installer() fi } - function find_git() - { - depCount=$((depCount+1)) - - GIT_PATH=`which git 2>/dev/null` - - if [[ -f $GIT_PATH ]] - then - check "$($GIT_PATH --version)" - isGit=true - depFound=$((depFound+1)) - else - uncheck "Git is missing" - isGit=false - fi - } - - function find_ruby() - { - depCount=$((depCount+1)) - - RUBY_PATH=`which ruby 2>/dev/null` - - if [[ -f $RUBY_PATH ]] - then - RUBY_VERSION=`ruby -e "print RUBY_VERSION"` - check "Ruby ${RUBY_VERSION}" - isRuby=true - depFound=$((depFound+1)) - else - uncheck "Ruby is missing 🔥" - isRuby=false - canContinue=false - errorMessages+="${red}==>${reset} ${b}Couldn't find Ruby:${reset} Brew requires Ruby which could not be found.\n" - errorMessages+=" Please install Ruby using these instructions ${u}${blue}https://www.ruby-lang.org/en/documentation/installation/${reset}.\n" - fi - } - - function find_brew() - { - BREW_PATH=`which brew 2>/dev/null` - - if [[ -f $BREW_PATH ]] - then - check "$($BREW_PATH -v)" - isBrew=true - depFound=$((depFound+1)) - else - uncheck "Homebrew is missing" - isBrew=false - - INSTALL_FILES+="${blue}${dim}==> Homebrew:${reset}\n" - INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/bin/brew\n" - INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/Library\n" - INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/share/man/man1/brew.1\n" - fi - - depCount=$((depCount+1)) - } - - function install_brew() - { - if [[ $isBrew == false ]] - then - head "Installing Homebrew" - - if [[ $isRuby == true ]] - then - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - else - cd /usr - - if [[ ! -d $HOMEBREW_PREFIX ]] - then - sudo mkdir $HOMEBREW_PREFIX - sudo chmod g+rwx $HOMEBREW_PREFIX - fi - - if [[ ! -d $HOMEBREW_CACHE ]] - then - sudo mkdir $HOMEBREW_CACHE - sudo chmod g+rwx $HOMEBREW_CACHE - fi - - DEVELOPER_DIR=`/usr/bin/xcode-select -print-path 2>/dev/null` - - if [[ ! $(ls -A $DEVELOPER_DIR) || ! -f $DEVELOPER_DIR/usr/bin/git ]] - then - info "Installing the Command Line Tools (expect a GUI popup):" - sudo /usr/bin/xcode-select --install - - echo "Press any key when the installation has completed" - fi - - cd $HOMEBREW_PREFIX - - bash -o pipefail -c "curl -fsSL ${HOMEBREW_REPO}/tarball/master | tar xz -m --strip 1" - fi - - find_brew - echo - - if [[ $isBrew == false ]] - then - abortInstall "Couldn't install brew" - fi - fi - } - function osx_installer() { - osx_dependency_installer - info "Adding ethcore repository" brew tap ethcore/ethcore https://github.com/ethcore/homebrew-ethcore.git echo @@ -343,64 +187,24 @@ function run_installer() echo } - function osx_dependency_installer() + function build_parity() { - if [[ $isGit == false ]]; - then - echo "Installing Git" - fi + info "Downloading Parity..." + git clone git@github.com:ethcore/parity + cd parity + git submodule init + git submodule update + + info "Building & testing Parity..." + cargo test --release -p ethcore-util - if [[ $isRuby == false ]]; - then - echo "Installing Ruby" - fi + info "Running consensus tests..." + git submodule update -i + cargo test --release --features ethcore/json-tests -p ethcore - if [[ $isBrew == false ]]; - then - install_brew - fi - } - - function get_linux_dependencies() - { - find_apt - find_docker - } - - function find_apt() - { - APT_PATH=`which apt-get 2>/dev/null` - - if [[ -f $APT_PATH ]] - then - check "apt-get" - echo "$($APT_PATH -v)" - isApt=true - else - uncheck "apt-get is missing" - isApt=false - fi - } - - function find_docker() - { - DOCKER_PATH=`which docker 2>/dev/null` - - if [[ -f $DOCKER_PATH ]] - then - check "docker" - echo "$($DOCKER_PATH -v)" - isDocker=true - else - isDocker=false - fi - } - function linux_rocksdb_installer() - { - sudo add-apt-repository -y ppa:giskou/librocksdb - sudo apt-get -f -y install - sudo apt-get update - sudo apt-get install -y librocksdb + echo + info "Parity source code is in $(pwd)/parity" + info "Run a client with: ${b}cargo run --release${reset}" } function linux_installer() @@ -413,34 +217,43 @@ function run_installer() linux_rocksdb_installer echo - info "Installing parity" - file=/tmp/parity.deb - - - wget $PARITY_DEB_URL -qO $file - sudo dpkg -i $file - rm $file + build_parity } function install_netstats() { - echo "install netstats" - - if [[ $isDocker == false ]] - then - info "installing docker" - curl -sSL https://get.docker.com/ | sh - fi - - dir=$HOME/.netstats + echo "Installing netstats" secret=$(prompt_for_input "Please enter the netstats secret:") instance_name=$(prompt_for_input "Please enter your instance name:") contact_details=$(prompt_for_input "Please enter your contact details (optional):") + # install ethereum & install dependencies + sudo apt-get install -y -qq build-essential git unzip wget nodejs npm ntp cloud-utils - mkdir -p $dir - cat > $dir/app.json << EOL + # add node symlink if it doesn't exist + [[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node + + # set up time update cronjob + sudo bash -c "cat > /etc/cron.hourly/ntpdate << EOF + #!/bin/sh + pm2 flush + sudo service ntp stop + sudo ntpdate -s ntp.ubuntu.com + sudo service ntp start + EOF" + + sudo chmod 755 /etc/cron.hourly/ntpdate + + [ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api netstats + cd netstats + git pull + git checkout 95d595258239a0fdf56b97dedcfb2be62f6170e6 + + sudo npm install + sudo npm install pm2 -g + + cat > app.json << EOL [ { "name" : "node-app", @@ -468,16 +281,13 @@ function run_installer() ] EOL - sudo docker rm --force netstats-client 2> /dev/null - sudo docker pull ethcore/netstats-client - sudo docker run -d --net=host --name netstats-client -v $dir/app.json:/home/ethnetintel/eth-net-intelligence-api/app.json ethcore/netstats-client + pm2 start app.json + cd .. } + function install() { - echo - head "Installing Parity build dependencies" - if [[ $OS_TYPE == "osx" ]] then osx_installer @@ -517,26 +327,21 @@ EOL exit 0 } - # Check dependencies - head "Checking OS dependencies" + bash <(curl $GET_DEPS_URL -L) + detectOS - echo - head "In addition to the parity build dependencies, this script will install:" - echo "$INSTALL_FILES" - echo - # Prompt user to continue or abort - if wait_for_user "${b}OK,${reset} let's go!" + if wait_for_user "${b}OK,${reset} let's install Parity now!" then echo "Installing..." else abortInstall "${red}==>${reset} Process stopped by user. To resume the install run the one-liner command again." fi - # Install dependencies and eth install - + verify_installation + if [[ $OS_TYPE == "linux" ]] then echo "Netstats:" @@ -547,10 +352,8 @@ EOL fi fi - # Check installation - verify_installation - # Display goodby message + # Display goodbye message finish } From 4653355241121855c04508e85cc09aeaac518b43 Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Thu, 4 Feb 2016 22:45:30 +0000 Subject: [PATCH 03/36] get deps url --- install-parity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-parity.sh b/install-parity.sh index 9c0a40181..aa8524e99 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -GET_DEPS_URL=https://raw.githubusercontent.com/ethcore/parity/install-parity/install-deps.sh?token=ABG4GdRAtO16t1U9l7JJgMDhf92CzHBWks5WvP6qwA%3D%3D +GET_DEPS_URL=https://raw.githubusercontent.com/ethcore/parity/install-parity/install-deps.sh?token=ABG4GbR8ozeZ4u9VPNK-_fUaWS4l-l6Xks5WvQ7ywA%3D%3D function run_installer() { From 9a71f684d4de1fb94829f1c55865f6107da1421f Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Thu, 4 Feb 2016 23:03:56 +0000 Subject: [PATCH 04/36] slimming down the installer --- install-deps.sh | 17 ----------------- install-parity.sh | 19 ++----------------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/install-deps.sh b/install-deps.sh index a641f3659..cb8cc2186 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -385,7 +385,6 @@ function run_installer() find_gcc find_apt - find_docker } function find_rocksdb() @@ -519,22 +518,6 @@ function run_installer() fi } - function find_docker() - { - depCount=$((depCount+1)) - DOCKER_PATH=`which docker 2>/dev/null` - - if [[ -f $DOCKER_PATH ]] - then - depFound=$((depFound+1)) - check "docker" - echo "$($DOCKER_PATH -v)" - isDocker=true - else - isDocker=false - uncheck "docker is missing" - fi - } function ubuntu1404_rocksdb_installer() { diff --git a/install-parity.sh b/install-parity.sh index aa8524e99..7d219b1cf 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -195,12 +195,8 @@ function run_installer() git submodule init git submodule update - info "Building & testing Parity..." - cargo test --release -p ethcore-util - - info "Running consensus tests..." - git submodule update -i - cargo test --release --features ethcore/json-tests -p ethcore + info "Building Parity..." + cargo build --release echo info "Parity source code is in $(pwd)/parity" @@ -297,16 +293,6 @@ EOL fi } - function verify_installation() - { - info "Verifying installation" - find_eth - - if [[ $isEth == false ]] - then - abortInstall - fi - } function abortInstall() { @@ -340,7 +326,6 @@ EOL fi install - verify_installation if [[ $OS_TYPE == "linux" ]] then From 1ff5645108a49509ceb4b3d29380c5981aef1a70 Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Thu, 4 Feb 2016 23:05:17 +0000 Subject: [PATCH 05/36] updated the deps url --- install-parity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-parity.sh b/install-parity.sh index 7d219b1cf..3cd0c2ea8 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -GET_DEPS_URL=https://raw.githubusercontent.com/ethcore/parity/install-parity/install-deps.sh?token=ABG4GbR8ozeZ4u9VPNK-_fUaWS4l-l6Xks5WvQ7ywA%3D%3D +GET_DEPS_URL=https://raw.githubusercontent.com/ethcore/parity/install-parity/install-deps.sh?token=ABG4GSrcbr5ls3LMAJ0Zpu6RrtUy50MZks5WvROhwA%3D%3D function run_installer() { From 51cd06b69f517e9e67c936ef2ef302b34519075c Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Thu, 4 Feb 2016 23:13:03 +0000 Subject: [PATCH 06/36] create parity in home --- install-parity.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install-parity.sh b/install-parity.sh index 3cd0c2ea8..4b6ba62f2 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -190,8 +190,8 @@ function run_installer() function build_parity() { info "Downloading Parity..." - git clone git@github.com:ethcore/parity - cd parity + git clone git@github.com:ethcore/parity $HOME/parity + cd $HOME/parity git submodule init git submodule update From dea838fc4693a95ef78ff87b2c7681d9f0cee00c Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Thu, 4 Feb 2016 23:14:14 +0000 Subject: [PATCH 07/36] get deps proper link --- install-parity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-parity.sh b/install-parity.sh index 4b6ba62f2..fed8b2b00 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -GET_DEPS_URL=https://raw.githubusercontent.com/ethcore/parity/install-parity/install-deps.sh?token=ABG4GSrcbr5ls3LMAJ0Zpu6RrtUy50MZks5WvROhwA%3D%3D +GET_DEPS_URL=https://get-deps.ethcore.io function run_installer() { From 1a7b6e1770e5874c718ce55df8113088006a535e Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Thu, 4 Feb 2016 23:28:22 +0000 Subject: [PATCH 08/36] installing node 12 --- install-parity.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/install-parity.sh b/install-parity.sh index fed8b2b00..d33f31bc9 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -7,12 +7,6 @@ function run_installer() { ####### Init vars - HOMEBREW_PREFIX=/usr/local - HOMEBREW_CACHE=/Library/Caches/Homebrew - HOMEBREW_REPO=https://github.com/Homebrew/homebrew - OSX_REQUIERED_VERSION="10.7.0" - - declare OS_TYPE declare OSX_VERSION declare GIT_PATH @@ -198,9 +192,11 @@ function run_installer() info "Building Parity..." cargo build --release + sudo cp target/release/parity /usr/bin/ + echo info "Parity source code is in $(pwd)/parity" - info "Run a client with: ${b}cargo run --release${reset}" + info "Run a client with: ${b}cargo run --release${reset} or just ${b}parity${reset}" } function linux_installer() @@ -223,7 +219,9 @@ function run_installer() secret=$(prompt_for_input "Please enter the netstats secret:") instance_name=$(prompt_for_input "Please enter your instance name:") contact_details=$(prompt_for_input "Please enter your contact details (optional):") - + + curl -sL https://deb.nodesource.com/setup_0.12 | bash - + sudo apt-get update # install ethereum & install dependencies sudo apt-get install -y -qq build-essential git unzip wget nodejs npm ntp cloud-utils From 68151d45be92e458481df7bbdacd0b6807a0e3c4 Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Thu, 4 Feb 2016 23:30:42 +0000 Subject: [PATCH 09/36] var cleanup --- install-parity.sh | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/install-parity.sh b/install-parity.sh index d33f31bc9..b2160bea9 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -8,23 +8,6 @@ function run_installer() ####### Init vars declare OS_TYPE - declare OSX_VERSION - declare GIT_PATH - declare RUBY_PATH - declare BREW_PATH - declare INSTALL_FILES="" - - errorMessages="" - isOsVersion=false - isGit=false - isRuby=false - isBrew=false - isDocker=false - canContinue=true - depCount=0 - depFound=0 - - ####### Setup colors From 348c4f116af6287b1fcb0afb7b2c68794a25b2fa Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Thu, 4 Feb 2016 23:48:01 +0000 Subject: [PATCH 10/36] deps url as http --- install-parity.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/install-parity.sh b/install-parity.sh index b2160bea9..6b5bccc7c 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -GET_DEPS_URL=https://get-deps.ethcore.io +GET_DEPS_URL=http://get-deps.ethcore.io function run_installer() { @@ -184,14 +184,6 @@ function run_installer() function linux_installer() { - info "Installing dependencies" - sudo apt-get update && sudo apt-get install -q -y git curl g++ wget - echo - - info "Installing rocksdb" - linux_rocksdb_installer - echo - build_parity } From 0059747077dda7b12817f62c8c806e09bfaa8f9d Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 00:06:39 +0000 Subject: [PATCH 11/36] removed npm from apt-get install; caching last dir --- install-parity.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/install-parity.sh b/install-parity.sh index 6b5bccc7c..a6697a840 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -166,6 +166,7 @@ function run_installer() function build_parity() { + oldpwd= $(pwd) info "Downloading Parity..." git clone git@github.com:ethcore/parity $HOME/parity cd $HOME/parity @@ -177,6 +178,8 @@ function run_installer() sudo cp target/release/parity /usr/bin/ + cd $oldpwd + echo info "Parity source code is in $(pwd)/parity" info "Run a client with: ${b}cargo run --release${reset} or just ${b}parity${reset}" @@ -198,7 +201,7 @@ function run_installer() curl -sL https://deb.nodesource.com/setup_0.12 | bash - sudo apt-get update # install ethereum & install dependencies - sudo apt-get install -y -qq build-essential git unzip wget nodejs npm ntp cloud-utils + sudo apt-get install -y -qq build-essential git unzip wget nodejs ntp cloud-utils # add node symlink if it doesn't exist [[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node @@ -215,6 +218,7 @@ function run_installer() sudo chmod 755 /etc/cron.hourly/ntpdate [ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api netstats + oldpwd= $(pwd) cd netstats git pull git checkout 95d595258239a0fdf56b97dedcfb2be62f6170e6 @@ -251,7 +255,7 @@ function run_installer() EOL pm2 start app.json - cd .. + cd $oldpwd } From 4513229b2b96f4b8ec632c368851504821e6391a Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 00:23:07 +0000 Subject: [PATCH 12/36] skipping prompt for install (just doing it) --- install-parity.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/install-parity.sh b/install-parity.sh index a6697a840..452d8ff9e 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -294,14 +294,7 @@ EOL detectOS - # Prompt user to continue or abort - if wait_for_user "${b}OK,${reset} let's install Parity now!" - then - echo "Installing..." - else - abortInstall "${red}==>${reset} Process stopped by user. To resume the install run the one-liner command again." - fi - + head "${b}OK,${reset} let's install Parity now!" install if [[ $OS_TYPE == "linux" ]] From f7079a1e72ff08ac1b0ce1036fbe72593f1e87ea Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 00:24:17 +0000 Subject: [PATCH 13/36] 2 echos --- install-parity.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install-parity.sh b/install-parity.sh index 452d8ff9e..10a057c3a 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -295,6 +295,8 @@ EOL detectOS head "${b}OK,${reset} let's install Parity now!" + echo + echo install if [[ $OS_TYPE == "linux" ]] From 2fa662cf110bdaf455bee3d578b274fce04fea49 Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 11:40:13 +0000 Subject: [PATCH 14/36] revert install-deps --- install-deps.sh | 114 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/install-deps.sh b/install-deps.sh index cb8cc2186..5c42bcf2a 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -385,6 +385,7 @@ function run_installer() find_gcc find_apt + find_docker } function find_rocksdb() @@ -518,6 +519,22 @@ function run_installer() fi } + function find_docker() + { + depCount=$((depCount+1)) + DOCKER_PATH=`which docker 2>/dev/null` + + if [[ -f $DOCKER_PATH ]] + then + depFound=$((depFound+1)) + check "docker" + echo "$($DOCKER_PATH -v)" + isDocker=true + else + isDocker=false + uncheck "docker is missing" + fi + } function ubuntu1404_rocksdb_installer() { @@ -619,6 +636,89 @@ function run_installer() fi } + function build_parity() + { + info "Downloading Parity..." + git clone git@github.com:ethcore/parity + cd parity + git submodule init + git submodule update + + info "Building & testing Parity..." + cargo test --release -p ethcore-util + + info "Running consensus tests..." + cargo test --release --features ethcore/json-tests -p ethcore + + echo + info "Parity source code is in $(pwd)/parity" + info "Run a client with: ${b}cargo run --release${reset}" + } + + function install_netstats() + { + echo "Installing netstats" + + secret=$(prompt_for_input "Please enter the netstats secret:") + instance_name=$(prompt_for_input "Please enter your instance name:") + contact_details=$(prompt_for_input "Please enter your contact details (optional):") + + # install ethereum & install dependencies + sudo apt-get install -y -qq build-essential git unzip wget nodejs npm ntp cloud-utils + + # add node symlink if it doesn't exist + [[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node + + # set up time update cronjob + sudo bash -c "cat > /etc/cron.hourly/ntpdate << EOF + #!/bin/sh + pm2 flush + sudo service ntp stop + sudo ntpdate -s ntp.ubuntu.com + sudo service ntp start + EOF" + + sudo chmod 755 /etc/cron.hourly/ntpdate + + [ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api netstats + cd netstats + git pull + git checkout 95d595258239a0fdf56b97dedcfb2be62f6170e6 + + sudo npm install + sudo npm install pm2 -g + + cat > app.json << EOL +[ + { + "name" : "node-app", + "script" : "app.js", + "log_date_format" : "YYYY-MM-DD HH:mm Z", + "merge_logs" : false, + "watch" : false, + "max_restarts" : 10, + "exec_interpreter" : "node", + "exec_mode" : "fork_mode", + "env": + { + "NODE_ENV" : "production", + "RPC_HOST" : "localhost", + "RPC_PORT" : "8545", + "LISTENING_PORT" : "30303", + "INSTANCE_NAME" : "${instance_name}", + "CONTACT_DETAILS" : "${contact_details}", + "WS_SERVER" : "wss://rpc.ethstats.net", + "WS_SECRET" : "${secret}", + "VERBOSITY" : 2 + + } + } +] +EOL + + pm2 start app.json + cd .. + } function abortInstall() { @@ -666,6 +766,20 @@ function run_installer() # Check installation verify_installation + if [[ ! -e parity ]]; then + # Maybe install parity + if wait_for_user "${b}Build dependencies installed B-)!${reset} Would you like to download and build parity?"; then + # Do get parity. + build_parity + fi + fi + + if [[ $OS_TYPE == "linux" && $DISTRIB_ID == "Ubuntu" ]]; then + if wait_for_user "${b}Netstats:${reset} Would you like to install and configure a netstats client?"; then + install_netstats + fi + fi + # Display goodby message finish } From c7776c38fd58717dcbd66bb2a7d6596415c92fc0 Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 11:49:28 +0000 Subject: [PATCH 15/36] check os --- install-parity.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/install-parity.sh b/install-parity.sh index 10a057c3a..896ee7572 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -290,10 +290,16 @@ EOL exit 0 } - bash <(curl $GET_DEPS_URL -L) - + head "Checking OS dependencies" detectOS + if [[ $INSTALL_FILES != "" ]]; then + echo + head "In addition to the Parity build dependencies, this script will install:" + echo "$INSTALL_FILES" + echo + fi + head "${b}OK,${reset} let's install Parity now!" echo echo From c8a556c47cc5867cb18601a7fe5255ffd4cf810d Mon Sep 17 00:00:00 2001 From: Konstantin Kudryavtsev Date: Fri, 5 Feb 2016 06:55:15 -0500 Subject: [PATCH 16/36] install-deps doesn't need docker any more --- install-deps.sh | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/install-deps.sh b/install-deps.sh index 5c42bcf2a..bae8fc9a6 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -385,7 +385,6 @@ function run_installer() find_gcc find_apt - find_docker } function find_rocksdb() @@ -519,23 +518,6 @@ function run_installer() fi } - function find_docker() - { - depCount=$((depCount+1)) - DOCKER_PATH=`which docker 2>/dev/null` - - if [[ -f $DOCKER_PATH ]] - then - depFound=$((depFound+1)) - check "docker" - echo "$($DOCKER_PATH -v)" - isDocker=true - else - isDocker=false - uncheck "docker is missing" - fi - } - function ubuntu1404_rocksdb_installer() { sudo apt-get update -qq From f06e444737519361c84b40dacb9e947c65fc01ff Mon Sep 17 00:00:00 2001 From: arkpar Date: Fri, 5 Feb 2016 13:49:36 +0100 Subject: [PATCH 17/36] Raise FD limit for macos --- Cargo.toml | 1 + parity/main.rs | 2 + util/fdlimit/Cargo.toml | 10 +++++ util/fdlimit/src/lib.rs | 18 +++++++++ util/fdlimit/src/raise_fd_limit.rs | 62 ++++++++++++++++++++++++++++++ 5 files changed, 93 insertions(+) create mode 100644 util/fdlimit/Cargo.toml create mode 100644 util/fdlimit/src/lib.rs create mode 100644 util/fdlimit/src/raise_fd_limit.rs diff --git a/Cargo.toml b/Cargo.toml index 6766a5b2c..1eac83ac3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ ethcore-util = { path = "util" } ethcore = { path = "ethcore" } ethsync = { path = "sync" } ethcore-rpc = { path = "rpc", optional = true } +fdlimit = { path = "util/fdlimit" } [features] default = ["rpc"] diff --git a/parity/main.rs b/parity/main.rs index bc492277a..3370645be 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -12,6 +12,7 @@ extern crate ethsync; extern crate log as rlog; extern crate env_logger; extern crate ctrlc; +extern crate fdlimit; #[cfg(feature = "rpc")] extern crate ethcore_rpc as rpc; @@ -79,6 +80,7 @@ fn main() { let args: Args = Args::docopt().decode().unwrap_or_else(|e| e.exit()); setup_log(&args.flag_logging); + unsafe { ::fdlimit::raise_fd_limit(); } let spec = ethereum::new_frontier(); let init_nodes = match args.arg_enode.len() { diff --git a/util/fdlimit/Cargo.toml b/util/fdlimit/Cargo.toml new file mode 100644 index 000000000..42aa582fe --- /dev/null +++ b/util/fdlimit/Cargo.toml @@ -0,0 +1,10 @@ +[package] +description = "Utility function to raise file descriptor limit on OS X" +homepage = "http://ethcore.io" +license = "GPL-3.0" +name = "fdlimit" +version = "0.1.0" +authors = ["Ethcore "] + +[dependencies] +libc = "0.2" diff --git a/util/fdlimit/src/lib.rs b/util/fdlimit/src/lib.rs new file mode 100644 index 000000000..e659bb8c9 --- /dev/null +++ b/util/fdlimit/src/lib.rs @@ -0,0 +1,18 @@ +// Copyright 2015, 2016 Ethcore (UK) Ltd. +// This file is part of Parity. +// +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see .extern crate libc; +extern crate libc; +pub mod raise_fd_limit; +pub use raise_fd_limit::raise_fd_limit; diff --git a/util/fdlimit/src/raise_fd_limit.rs b/util/fdlimit/src/raise_fd_limit.rs new file mode 100644 index 000000000..0cf90ec95 --- /dev/null +++ b/util/fdlimit/src/raise_fd_limit.rs @@ -0,0 +1,62 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +/// darwin_fd_limit exists to work around an issue where launchctl on Mac OS X +/// defaults the rlimit maxfiles to 256/unlimited. The default soft limit of 256 +/// ends up being far too low for our multithreaded scheduler testing, depending +/// on the number of cores available. +/// +/// This fixes issue #7772. +#[cfg(any(target_os = "macos", target_os = "ios"))] +#[allow(non_camel_case_types)] +pub unsafe fn raise_fd_limit() { + use libc; + use std::cmp; + use std::io; + use std::mem::size_of_val; + use std::ptr::null_mut; + + static CTL_KERN: libc::c_int = 1; + static KERN_MAXFILESPERPROC: libc::c_int = 29; + + // The strategy here is to fetch the current resource limits, read the + // kern.maxfilesperproc sysctl value, and bump the soft resource limit for + // maxfiles up to the sysctl value. + + // Fetch the kern.maxfilesperproc value + let mut mib: [libc::c_int; 2] = [CTL_KERN, KERN_MAXFILESPERPROC]; + let mut maxfiles: libc::c_int = 0; + let mut size: libc::size_t = size_of_val(&maxfiles) as libc::size_t; + if libc::sysctl(&mut mib[0], 2, &mut maxfiles as *mut _ as *mut _, &mut size, + null_mut(), 0) != 0 { + let err = io::Error::last_os_error(); + panic!("raise_fd_limit: error calling sysctl: {}", err); + } + + // Fetch the current resource limits + let mut rlim = libc::rlimit{rlim_cur: 0, rlim_max: 0}; + if libc::getrlimit(libc::RLIMIT_NOFILE, &mut rlim) != 0 { + let err = io::Error::last_os_error(); + panic!("raise_fd_limit: error calling getrlimit: {}", err); + } + + // Bump the soft limit to the smaller of kern.maxfilesperproc and the hard + // limit + rlim.rlim_cur = cmp::min(maxfiles as libc::rlim_t, rlim.rlim_max); + + // Set our newly-increased resource limit + if libc::setrlimit(libc::RLIMIT_NOFILE, &rlim) != 0 { + let err = io::Error::last_os_error(); + panic!("raise_fd_limit: error calling setrlimit: {}", err); + } +} + +#[cfg(not(any(target_os = "macos", target_os = "ios")))] +pub unsafe fn raise_fd_limit() {} From 7dcb1b7b3346686ad583d01c4533ac2a7a189d93 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 5 Feb 2016 13:51:35 +0100 Subject: [PATCH 18/36] Travis slack integration. --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7589697af..fceed1a75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,3 +64,11 @@ deploy: file: parity${ARCHIVE_SUFFIX}.tar.gz on: tags: true + +notifications: + webhooks: + urls: + - https://hooks.slack.com/services/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 + on_success: always + on_failure: always + on_start: never \ No newline at end of file From 0504bc17ce1e50595a995eb6e3152689816c8cd5 Mon Sep 17 00:00:00 2001 From: arkpar Date: Fri, 5 Feb 2016 13:55:29 +0100 Subject: [PATCH 19/36] Removed issue comment --- util/fdlimit/src/raise_fd_limit.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/util/fdlimit/src/raise_fd_limit.rs b/util/fdlimit/src/raise_fd_limit.rs index 0cf90ec95..f57ac2785 100644 --- a/util/fdlimit/src/raise_fd_limit.rs +++ b/util/fdlimit/src/raise_fd_limit.rs @@ -13,7 +13,6 @@ /// ends up being far too low for our multithreaded scheduler testing, depending /// on the number of cores available. /// -/// This fixes issue #7772. #[cfg(any(target_os = "macos", target_os = "ios"))] #[allow(non_camel_case_types)] pub unsafe fn raise_fd_limit() { From ff9f044ecea9e5edcfdb9bb38e2fb793f58ffbb3 Mon Sep 17 00:00:00 2001 From: debris Date: Fri, 5 Feb 2016 14:03:10 +0100 Subject: [PATCH 20/36] make slackwebhook secure --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fceed1a75..816e6d883 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,6 +55,7 @@ env: global: - secure: 3sUjNi9mhdL5h1GTm8LONnDN/SYvUHT+WSkMl93h3nYiLCQXk8eZaPS98AS7oOaTsfW4UvnwckVFCFl49ttInsv4cd/TkAxmrJHe6kPyS9/4NWUdmP8BjicbBvL/ioSdXMECMEYzPDLV+I3KhtC2LcB6ceDEl/XwMOJlzbGf7RbtcXGVQgMLqSYY1YKjQA4vbT5nFgIS/sZu3Z9yFgN0GafnihKcizqoHhdJjs/zxmX+qJepnC6o3V6KcFnS7QHhM1JOr85twE6S422UlvNaEb5ovwLPqmOl5+fA+6shbx4AxFTY6E9Iors+OVY/JliFhrqOdCt0i2P1FUHN4kbGZQkf0rphN/ZOI2uKNFTOyXiPvppfo/ZemKmcqkwkqP9+lf5QqYmtE6hsAYagxn49xJZILl8tAYbdqxF5gxa+TEVrfsBFtz/Sv3q8QhKQNPAmjEcKyMatyEreLUIFEpFTGIco8jN4eXeSoLRdJ+Z75ihttfQWhNfUDgNL30iQLy0AgFSsh/cyb5M8y9lxrGDzDTogvaiKGwr/V45sPkcXWCkmOgMdINqBB6ZtdL3bGHdyjmYj+y3btjf3aP11k++BL0fXIaKn25aS/p/9iyGb1FyGCM03o4ZRQ3YhTOvfMRfRGf6nWbaMx9upv8o5ShSdysewhrnh3082r7u896ny1Ho= - secure: 0/FeVvFl3AhBW0TCPoujY9zOAYoUNMlAz3XjC04vlc4Ksfx0lGU3KFi97LlALxMWV0lfwQc7ixSe2vTgQVQuLVSU9XEW40fQgEjJlmLca2RcRx1kfzJDypuWSiCME7MWmLPH0ac4COdTDS1z5WGggv5YB7GQPCzFvcmOOaPYtF29ngCtkyB2HmNkY/W3omHFEk7Si6bsmOSHZiOAhivPl6ixnGpFyTEKPyraMMqPIj5rbEGkzgeLTiXf2ur143n/tnSr8tmP1MfQi9yS8/ONidMqnxUeuLkeNnb82zj9pVJhVXq0xF44WXJ8Za1jm0ByiTakgqpm8Juk822qjvtNulJ1XZW/fyZQZaN1dy3uq5Ud3W8wS9M7VIVl8CoXozzDpIsdPeUAtkAxeHBsZqL1vAH2yC1YJA7HPySMYzCjYqkJ2r62xYk0gXmNXphfU+F/X/rHzHsTMJPONJ54HQwu12m7zVlKIYBGHgEXg/HAM/g4ljUzl6WWR/nHH/tQM8ND/8FpHluJSZJWacq/1QNhVdTq2x6cqws2fs5A7nVpccR9+6RRgYgv6+YS2LxvFzByuZveGGoKif+uMECXN876j40araUqU528Yz9i8bHJlnM3coRBndaLNWByLcUyXCB9r9IUosUu41rr+L2mVzkSDm0GicuNCzqvzYQ9Q6QY4uQ= + - secure: DglvLR27MrBKQO/8s7ZfGqfimXk1Iq5MreCTc+ZkWMkZ0sDP76YBUPq5j25hcg0Z09z09O2Q5OUOyYkhVD4AnRjoRLUplHdpDE9CBSz2vUGpMpzhgAqzBc6SDsEmWU2JlAPBraIODXQdP/Qo6tYY4zn3vwd/VFKo27GTb5b60WAkTVvT/0YPWycEXFIa7sNMgjNI0EnT+Se5USDYwb6MM1T9JxJot0q3WtOnsVyroCHJp4QDicpS8eQIu3Tl+SLE4d0EoJ4YYLOI+jWOybipuO1xM1xlHq/gpWfjKqbJh24xtAds524dN7ujfjAhyO2zQbuTOfi7QVOj/Go0tGYxNxobR4pYG783Aiq3Quj0GzSrLEAatkk5tGOcuVJ98EYIg3WPJuC93waTTXcS0xDyy09XHxWxZ/5PiXorRZjpHvnZfRF0X4Mus6jUJ7hqDuOUiF5BI1RHomHvJQQHUrLdmh7OHyrer3YUpKRs65tww6H+VM+lKNa3MnMkB5+or/co14svs7I4pni9S+aZg//bwuxGVXchK6bjLCP1X99Ar4fA5EGsTVdjp3PRqutM/P3RqNGkwTczat/PNZ8fFAD9y7pDs2L6YkqpflTC9d6vKTSl6gORGw6ltLUJs23ON6xRNIBMw1cXp67wN57vF46TPt1i3ZlIQsYn0pAVNKavbZE= deploy: provider: releases @@ -68,7 +69,7 @@ deploy: notifications: webhooks: urls: - - https://hooks.slack.com/services/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 + - https://hooks.slack.com/services/${SLACK_WEBHOOK} on_success: always on_failure: always - on_start: never \ No newline at end of file + on_start: never From 158d8530d24926c29e9d028835f845b3fdca88b4 Mon Sep 17 00:00:00 2001 From: Konstantin Kudryavtsev Date: Fri, 5 Feb 2016 08:39:49 -0500 Subject: [PATCH 21/36] working on 14 --- install-parity.sh | 842 ++++++++++++++++++++++++++++++---------------- 1 file changed, 559 insertions(+), 283 deletions(-) diff --git a/install-parity.sh b/install-parity.sh index 896ee7572..70999d0e1 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -2,322 +2,598 @@ GET_DEPS_URL=http://get-deps.ethcore.io +#PARITY_DEB_URL=https://github.com/ethcore/parity/releases/download/beta-0.9/parity_0.9.0-0_amd64.deb +PARITY_DEB_URL=https://github.com/jesuscript/scripts/raw/master/parity_0.9.0-0_amd64.deb function run_installer() { - ####### Init vars + ####### Init vars + + HOMEBREW_PREFIX=/usr/local + HOMEBREW_CACHE=/Library/Caches/Homebrew + HOMEBREW_REPO=https://github.com/Homebrew/homebrew + OSX_REQUIERED_VERSION="10.7.0" + + declare OS_TYPE + declare OSX_VERSION + declare GIT_PATH + declare RUBY_PATH + declare BREW_PATH + declare INSTALL_FILES="" + + errorMessages="" + isOsVersion=false + isGit=false + isRuby=false + isBrew=false + canContinue=true + depCount=0 + depFound=0 + + + ####### Setup colors + + red=`tput setaf 1` + green=`tput setaf 2` + yellow=`tput setaf 3` + blue=`tput setaf 4` + magenta=`tput setaf 5` + cyan=`tput setaf 6` + white=`tput setaf 7` + b=`tput bold` + u=`tput sgr 0 1` + ul=`tput smul` + xl=`tput rmul` + stou=`tput smso` + xtou=`tput rmso` + dim=`tput dim` + reverse=`tput rev` + reset=`tput sgr0` + + + function head() { + echo "${blue}${b}==>${white} $1${reset}" + } + + function info() { + echo "${blue}${b}==>${reset} $1" + } + + function successHeading() { + echo "${green}${b}==> $1${reset}" + } + + function success() { + echo "${green}${b}==>${reset}${green} $1${reset}" + } + + function error() { + echo "${red}==> ${u}${b}${red}$1${reset}" + } + + function smallError() { + echo "${red}==>${reset} $1" + } + + function green() { + echo "${green}$1${reset}" + } + + function red() { + echo "${red}$1${reset}" + } + + function check() { + echo "${green}${bold} ✓${reset} $1${reset}" + } + + function uncheck() { + echo "${red}${bold} ✘${reset} $1${reset}" + } + + + + ####### Setup methods + + function wait_for_user() { + while : + do + read -p "${blue}==>${reset} $1 [Y/n] " imp + case $imp in + [yY] ) return 0; break ;; + '' ) echo; break ;; + [nN] ) return 1 ;; + * ) echo "Unrecognized option provided. Please provide either 'Y' or 'N'"; + esac + done + } + + function prompt_for_input() { + while : + do + read -p "$1 " imp + echo $imp + return + done + } + + function exe() { + echo "\$ $@"; "$@" + } + + function detectOS() { + if [[ "$OSTYPE" == "linux-gnu" ]] + then + OS_TYPE="linux" + get_linux_dependencies + elif [[ "$OSTYPE" == "darwin"* ]] + then + OS_TYPE="osx" + get_osx_dependencies + else + OS_TYPE="win" + abortInstall "${red}==>${reset} ${b}OS not supported:${reset} parity one-liner currently support OS X and Linux.\nFor instructions on installing parity on other platforms please visit ${u}${blue}http://ethcore.io/${reset}" + fi + + echo + + if [[ $depCount == $depFound ]] + then + green "Found all dependencies ($depFound/$depCount)" + else + if [[ $canContinue == true ]] + then + red "Some dependencies are missing ($depFound/$depCount)" + elif [[ $canContinue == false && $depFound == 0 ]] + then + red "All dependencies are missing and cannot be auto-installed ($depFound/$depCount)" + abortInstall "$errorMessages"; + elif [[ $canContinue == false ]] + then + red "Some dependencies which cannot be auto-installed are missing ($depFound/$depCount)" + abortInstall "$errorMessages"; + fi + fi + } + + function linux_version() + { + source /etc/lsb-release + + if [[ $DISTRIB_ID == "Ubuntu" ]]; then + if [[ $DISTRIB_RELEASE == "14.04" ]]; then + check "Ubuntu-14.04" + isUbuntu1404=true + else + check "Ubuntu, but not 14.04" + isUbuntu1404=false + fi + else + check "Ubuntu not found" + isUbuntu1404=false + fi + } + + function get_linux_dependencies() + { + linux_version + + find_multirust + find_rocksdb + + find_curl + find_git + find_make + find_gcc + + find_apt + } + + function find_rocksdb() + { + depCount=$((depCount+1)) + if [[ $(ldconfig -v 2>/dev/null | grep rocksdb | wc -l) == 1 ]]; then + depFound=$((depFound+1)) + check "apt-get" + isRocksDB=true + else + uncheck "librocksdb is missing" + isRocksDB=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tlibrocksdb\n" + fi + } + + function find_multirust() + { + depCount=$((depCount+2)) + MULTIRUST_PATH=`which multirust 2>/dev/null` + if [[ -f $MULTIRUST_PATH ]]; then + depFound=$((depFound+1)) + check "multirust" + isMultirust=true + if [[ $(multirust show-default 2>/dev/null | grep nightly | wc -l) == 4 ]]; then + depFound=$((depFound+1)) + check "rust nightly" + isMultirustNightly=true + else + uncheck "rust is not nightly" + isMultirustNightly=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tmultirust -> rust nightly\n" + fi + else + uncheck "multirust is missing" + uncheck "rust nightly is missing" + isMultirust=false + isMultirustNightly=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tmultirust\n" + fi + } + + function find_apt() + { + depCount=$((depCount+1)) + + APT_PATH=`which apt-get 2>/dev/null` + + if [[ -f $APT_PATH ]] + then + depFound=$((depFound+1)) + check "apt-get" + isApt=true + else + uncheck "apt-get is missing" + isApt=false + + if [[ $isGCC == false || $isGit == false || $isMake == false || $isCurl == false ]]; then + canContinue=false + errorMessages+="${red}==>${reset} ${b}Couldn't find apt-get:${reset} We can only use apt-get in order to grab our dependencies.\n" + errorMessages+=" Please switch to a distribution such as Debian or Ubuntu or manually install the missing packages.\n" + fi + fi + } + + function find_gcc() + { + depCount=$((depCount+1)) + GCC_PATH=`which g++ 2>/dev/null` + + if [[ -f $GCC_PATH ]] + then + depFound=$((depFound+1)) + check "g++" + isGCC=true + else + uncheck "g++ is missing" + isGCC=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tg++\n" + fi + } + + function find_git() + { + depCount=$((depCount+1)) + GIT_PATH=`which git 2>/dev/null` + + if [[ -f $GIT_PATH ]] + then + depFound=$((depFound+1)) + check "git" + isGit=true + else + uncheck "git is missing" + isGit=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tgit\n" + fi + } + + function find_make() + { + depCount=$((depCount+1)) + MAKE_PATH=`which make 2>/dev/null` + + if [[ -f $MAKE_PATH ]] + then + depFound=$((depFound+1)) + check "make" + isMake=true + else + uncheck "make is missing" + isMake=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tmake\n" + fi + } + + function find_curl() + { + depCount=$((depCount+1)) + CURL_PATH=`which curl 2>/dev/null` + + if [[ -f $CURL_PATH ]] + then + depFound=$((depFound+1)) + check "curl" + isCurl=true + else + uncheck "curl is missing" + isCurl=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tcurl\n" + fi + } + + function ubuntu1404_rocksdb_installer() + { + sudo apt-get update -qq + sudo apt-get install -qq -y software-properties-common + sudo apt-add-repository -y ppa:giskou/librocksdb + sudo apt-get -f -y install + sudo apt-get update -qq + sudo apt-get install -qq -y librocksdb + } + + function linux_rocksdb_installer() + { + if [[ $isUbuntu1404 == true ]]; then + ubuntu1404_rocksdb_installer + else + oldpwd=`pwd` + cd /tmp + exe git clone --branch v4.1 --depth=1 https://github.com/facebook/rocksdb.git + cd rocksdb + exe make shared_lib + sudo cp -a librocksdb.so* /usr/lib + sudo ldconfig + cd /tmp + rm -rf /tmp/rocksdb + cd $oldpwd + fi + } + + + + function verify_installation() + { + ETH_PATH=`which parity 2>/dev/null` + + if [[ -f $ETH_PATH ]] + then + success "Parity has been installed" + else + error "Parity is missing" + abortInstall + fi + } - declare OS_TYPE + function verify_dep_installation() + { + info "Verifying installation" - ####### Setup colors + if [[ $OS_TYPE == "linux" ]]; then + find_curl + find_git + find_make + find_gcc + find_rocksdb + find_multirust - red=`tput setaf 1` - green=`tput setaf 2` - yellow=`tput setaf 3` - blue=`tput setaf 4` - magenta=`tput setaf 5` - cyan=`tput setaf 6` - white=`tput setaf 7` - b=`tput bold` - u=`tput sgr 0 1` - ul=`tput smul` - xl=`tput rmul` - stou=`tput smso` - xtou=`tput rmso` - dim=`tput dim` - reverse=`tput rev` - reset=`tput sgr0` - - - function head() { - echo "${blue}${b}==>${white} $1${reset}" - } - - function info() { - echo "${blue}${b}==>${reset} $1" - } - - function successHeading() { - echo "${green}${b}==> $1${reset}" - } - - function success() { - echo "${green}${b}==>${reset}${green} $1${reset}" - } - - function error() { - echo "${red}==> ${u}${b}${red}$1${reset}" - } - - function smallError() { - echo "${red}==>${reset} $1" - } - - function green() { - echo "${green}$1${reset}" - } - - function red() { - echo "${red}$1${reset}" - } - - function check() { - echo "${green}${bold} ✓${reset} $1${reset}" - } - - function uncheck() { - echo "${red}${bold} ✘${reset} $1${reset}" - } - - - - ####### Setup methods - - function wait_for_user() { - while : - do - read -p "${blue}==>${reset} $1 [Y/n] " imp - case $imp in - [yY] ) return 0; break ;; - '' ) echo; break ;; - [nN] ) return 1 ;; - * ) echo "Unrecognized option provided. Please provide either 'Y' or 'N'"; - esac - done - } - - function prompt_for_input() { - while : - do - read -p "$1 " imp - echo $imp - return - done - } + if [[ $isCurl == false || $isGit == false || $isMake == false || $isGCC == false || $isRocksDB == false || $isMultirustNightly == false ]]; then + abortInstall + fi + fi + } - function linux_version() - { - source /etc/lsb-release - - if [[ $DISTRIB_ID == "Ubuntu" ]]; then - if [[ $DISTRIB_RELEASE == "14.04" ]]; then - check "Ubuntu-14.04" - isUbuntu1404=true - else - check "Ubuntu, but not 14.04" - isUbuntu1404=false - fi - else - check "Ubuntu not found" - isUbuntu1404=false - fi - } + function linux_deps_installer() + { + if [[ $isGCC == false || $isGit == false || $isMake == false || $isCurl == false ]]; then + info "Installing build dependencies..." + sudo apt-get update -qq + if [[ $isGit == false ]]; then + sudo apt-get install -q -y git + fi + if [[ $isGCC == false ]]; then + sudo apt-get install -q -y g++ gcc + fi + if [[ $isMake == false ]]; then + sudo apt-get install -q -y make + fi + if [[ $isCurl == false ]]; then + sudo apt-get install -q -y curl + fi + echo + fi - function detectOS() { - if [[ "$OSTYPE" == "linux-gnu" ]] - then - OS_TYPE="linux" - linux_version - elif [[ "$OSTYPE" == "darwin"* ]] - then - OS_TYPE="osx" - else - OS_TYPE="win" - abortInstall "${red}==>${reset} ${b}OS not supported:${reset} parity one-liner currently support OS X and Linux.\nFor instructions on installing parity on other platforms please visit ${u}${blue}http://ethcore.io/${reset}" + if [[ $isRocksDB == false ]]; then + info "Installing rocksdb..." + linux_rocksdb_installer + echo + fi + + if [[ $isMultirust == false ]]; then + info "Installing multirust..." + curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sudo sh -s -- --yes + echo + fi + + if [[ $isMultirustNightly == false ]]; then + info "Installing rust nightly..." + sudo multirust update nightly + sudo multirust default nightly + echo fi - echo - } - - function find_eth() - { - ETH_PATH=`which parity 2>/dev/null` - - if [[ -f $ETH_PATH ]] - then - check "Found parity: $ETH_PATH" - isEth=true - else - uncheck "parity is missing" - isEth=false - fi - } - - function osx_installer() - { - info "Adding ethcore repository" - brew tap ethcore/ethcore https://github.com/ethcore/homebrew-ethcore.git - echo - - info "Updating brew" - brew update - echo + } + + function linux_installer() + { + linux_deps_installer + verify_dep_installation info "Installing parity" - if [[ $isEth == true ]] - then - brew reinstall parity - else - brew install parity - brew linkapps parity - fi - echo - } + file=/tmp/parity.deb - function build_parity() - { - oldpwd= $(pwd) - info "Downloading Parity..." - git clone git@github.com:ethcore/parity $HOME/parity - cd $HOME/parity - git submodule init - git submodule update - - info "Building Parity..." - cargo build --release + wget $PARITY_DEB_URL -qO $file + sudo dpkg -i $file + rm $file + } - sudo cp target/release/parity /usr/bin/ + function osx_installer() + { + info "Adding ethcore repository" + brew tap ethcore/ethcore https://github.com/ethcore/homebrew-ethcore.git + echo - cd $oldpwd + info "Updating brew" + brew update + echo - echo - info "Parity source code is in $(pwd)/parity" - info "Run a client with: ${b}cargo run --release${reset} or just ${b}parity${reset}" - } + info "Installing parity" + if [[ $isEth == true ]] + then + brew reinstall parity + else + brew install parity + brew linkapps parity + fi + echo + } + + function install() + { + echo + head "Installing Parity build dependencies" - function linux_installer() - { - build_parity - } + if [[ $OS_TYPE == "osx" ]] + then + osx_installer + elif [[ $OS_TYPE == "linux" ]] + then + linux_installer + fi - function install_netstats() - { - echo "Installing netstats" + verify_installation + } - secret=$(prompt_for_input "Please enter the netstats secret:") - instance_name=$(prompt_for_input "Please enter your instance name:") - contact_details=$(prompt_for_input "Please enter your contact details (optional):") + + function install_netstats() + { + echo "Installing netstats" - curl -sL https://deb.nodesource.com/setup_0.12 | bash - - sudo apt-get update - # install ethereum & install dependencies - sudo apt-get install -y -qq build-essential git unzip wget nodejs ntp cloud-utils + secret=$(prompt_for_input "Please enter the netstats secret:") + instance_name=$(prompt_for_input "Please enter your instance name:") + contact_details=$(prompt_for_input "Please enter your contact details (optional):") - # add node symlink if it doesn't exist - [[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node + curl -sL https://deb.nodesource.com/setup_0.12 | bash - + sudo apt-get update + # install ethereum & install dependencies + sudo apt-get install -y -qq build-essential git unzip wget nodejs ntp cloud-utils - # set up time update cronjob - sudo bash -c "cat > /etc/cron.hourly/ntpdate << EOF - #!/bin/sh - pm2 flush - sudo service ntp stop - sudo ntpdate -s ntp.ubuntu.com - sudo service ntp start - EOF" + # add node symlink if it doesn't exist + [[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node - sudo chmod 755 /etc/cron.hourly/ntpdate + # set up time update cronjob + sudo bash -c "cat > /etc/cron.hourly/ntpdate << EOF + #!/bin/sh + pm2 flush + sudo service ntp stop + sudo ntpdate -s ntp.ubuntu.com + sudo service ntp start + EOF" - [ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api netstats - oldpwd= $(pwd) - cd netstats - git pull - git checkout 95d595258239a0fdf56b97dedcfb2be62f6170e6 + sudo chmod 755 /etc/cron.hourly/ntpdate - sudo npm install - sudo npm install pm2 -g + cd $HOME - cat > app.json << EOL + [ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api netstats + oldpwd= $(pwd) + cd netstats + git pull + git checkout 95d595258239a0fdf56b97dedcfb2be62f6170e6 + + sudo npm install + sudo npm install pm2 -g + + cat > app.json << EOL [ - { - "name" : "node-app", - "script" : "app.js", - "log_date_format" : "YYYY-MM-DD HH:mm Z", - "merge_logs" : false, - "watch" : false, - "max_restarts" : 10, - "exec_interpreter" : "node", - "exec_mode" : "fork_mode", - "env": - { - "NODE_ENV" : "production", - "RPC_HOST" : "localhost", - "RPC_PORT" : "8545", - "LISTENING_PORT" : "30303", - "INSTANCE_NAME" : "${instance_name}", - "CONTACT_DETAILS" : "${contact_details}", - "WS_SERVER" : "wss://rpc.ethstats.net", - "WS_SECRET" : "${secret}", - "VERBOSITY" : 2 - - } - } + { + "name" : "node-app", + "script" : "app.js", + "log_date_format" : "YYYY-MM-DD HH:mm Z", + "merge_logs" : false, + "watch" : false, + "max_restarts" : 10, + "exec_interpreter" : "node", + "exec_mode" : "fork_mode", + "env": + { + "NODE_ENV" : "production", + "RPC_HOST" : "localhost", + "RPC_PORT" : "8545", + "LISTENING_PORT" : "30303", + "INSTANCE_NAME" : "${instance_name}", + "CONTACT_DETAILS" : "${contact_details}", + "WS_SERVER" : "wss://rpc.ethstats.net", + "WS_SECRET" : "${secret}", + "VERBOSITY" : 2 + + } + } ] EOL - pm2 start app.json - cd $oldpwd - } - + pm2 startOrRestart app.json + cd $oldpwd + } + - function install() - { - if [[ $OS_TYPE == "osx" ]] - then - osx_installer - elif [[ $OS_TYPE == "linux" ]] - then - linux_installer - fi - } + function abortInstall() + { + echo + error "Installation failed" + echo -e "$1" + echo + exit 0 + } + + function finish() + { + echo + successHeading "All done" + # head "Next steps" + # info "Run ${cyan}\`\`${reset} to get started.${reset}" + echo + exit 0 + } + + head "Checking OS dependencies" + detectOS + + if [[ $INSTALL_FILES != "" ]]; then + echo + head "In addition to the Parity build dependencies, this script will install:" + printf "$INSTALL_FILES" + echo + fi + + #DEBUG + + + head "${b}OK,${reset} let's install Parity now!" + echo + echo + install + + if [[ $OS_TYPE == "linux" ]] + then + echo "Netstats:" + head "Would you like to install and configure a netstats client?" + if wait_for_user "${b}OK,${reset} let's go!" + then + install_netstats + fi + fi - function abortInstall() - { - echo - error "Installation failed" - echo -e "$1" - echo - exit 0 - } - - function finish() - { - echo - successHeading "Installation successful!" - # head "Next steps" - # info "Run ${cyan}\`\`${reset} to get started.${reset}" - echo - exit 0 - } - - head "Checking OS dependencies" - detectOS - - if [[ $INSTALL_FILES != "" ]]; then - echo - head "In addition to the Parity build dependencies, this script will install:" - echo "$INSTALL_FILES" - echo - fi - - head "${b}OK,${reset} let's install Parity now!" - echo - echo - install - - if [[ $OS_TYPE == "linux" ]] - then - echo "Netstats:" - head "Would you like to install and configure a netstats client?" - if wait_for_user "${b}OK,${reset} let's go!" - then - install_netstats - fi - fi - - - # Display goodbye message - finish + # Display goodbye message + finish } run_installer From 499637606d52013922056874f642f91f6f6941d7 Mon Sep 17 00:00:00 2001 From: arkpar Date: Fri, 5 Feb 2016 15:08:18 +0100 Subject: [PATCH 22/36] DB directory versioning --- ethcore/src/client.rs | 9 ++++++++- ethcore/src/service.rs | 1 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ethcore/src/client.rs b/ethcore/src/client.rs index 6f688bd57..3a0309c1c 100644 --- a/ethcore/src/client.rs +++ b/ethcore/src/client.rs @@ -17,7 +17,7 @@ //! Blockchain database client. use util::*; -use rocksdb::{Options, DB}; +use rocksdb::{Options, DB, DBCompactionStyle}; use blockchain::{BlockChain, BlockProvider, CacheSize}; use views::BlockView; use error::*; @@ -163,16 +163,23 @@ pub struct Client { } const HISTORY: u64 = 1000; +const CLIENT_DB_VER_STR: &'static str = "1.0"; impl Client { /// Create a new client with given spec and DB path. pub fn new(spec: Spec, path: &Path, message_channel: IoChannel ) -> Result, Error> { + let mut dir = path.to_path_buf(); + dir.push(H64::from(spec.genesis_header().hash()).hex()); + //TODO: sec/fat: pruned/full versioning + dir.push(format!("v{}-sec-pruned", CLIENT_DB_VER_STR)); + let path = dir.as_path(); let gb = spec.genesis_block(); let chain = Arc::new(RwLock::new(BlockChain::new(&gb, path))); let mut opts = Options::new(); opts.set_max_open_files(256); opts.create_if_missing(true); opts.set_use_fsync(false); + opts.set_compaction_style(DBCompactionStyle::DBUniversalCompaction); /* opts.set_bytes_per_sync(8388608); opts.set_disable_data_sync(false); diff --git a/ethcore/src/service.rs b/ethcore/src/service.rs index 90fe0a6b5..92f483507 100644 --- a/ethcore/src/service.rs +++ b/ethcore/src/service.rs @@ -48,7 +48,6 @@ impl ClientService { info!("Configured for {} using {} engine", spec.name, spec.engine_name); let mut dir = env::home_dir().unwrap(); dir.push(".parity"); - dir.push(H64::from(spec.genesis_header().hash()).hex()); let client = try!(Client::new(spec, &dir, net_service.io().channel())); let client_io = Arc::new(ClientIoHandler { client: client.clone() From 691761c2007c9e889b2ae20ce798128e18767f85 Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 14:57:08 +0000 Subject: [PATCH 23/36] prompting before install --- install-parity.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install-parity.sh b/install-parity.sh index 70999d0e1..257d7c458 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -577,6 +577,8 @@ EOL head "${b}OK,${reset} let's install Parity now!" + wait_for_user "${b}Last chance!${reset} Sure you want to install this software?" + echo echo install From 1ee91d1d4dc60de97c9d02b42d605bf5e7605543 Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 15:24:33 +0000 Subject: [PATCH 24/36] added back the osx deps checkers --- install-parity.sh | 88 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/install-parity.sh b/install-parity.sh index 257d7c458..159a99dbc 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -156,6 +156,48 @@ function run_installer() fi } + function macos_version() + { + declare -a reqVersion + declare -a localVersion + + depCount=$((depCount+1)) + OSX_VERSION=`/usr/bin/sw_vers -productVersion 2>/dev/null` + + if [ -z "$OSX_VERSION" ] + then + uncheck "OS X version not supported 🔥" + isOsVersion=false + canContinue=false + else + IFS='.' read -a localVersion <<< "$OSX_VERSION" + IFS='.' read -a reqVersion <<< "$OSX_REQUIERED_VERSION" + + if (( ${reqVersion[0]} <= ${localVersion[0]} )) && (( ${reqVersion[1]} <= ${localVersion[1]} )) + then + check "OS X Version ${OSX_VERSION}" + isOsVersion=true + depFound=$((depFound+1)) + return + else + uncheck "OS X version not supported" + isOsVersion=false + canContinue=false + fi + fi + + errorMessages+="${red}==>${reset} ${b}Mac OS version too old:${reset} eth requires OS X version ${red}$OSX_REQUIERED_VERSION${reset} at least in order to run.\n" + errorMessages+=" Please update the OS and reload the install process.\n" + } + + function get_osx_dependencies() + { + macos_version + find_git + find_ruby + find_brew + } + function linux_version() { source /etc/lsb-release @@ -189,12 +231,55 @@ function run_installer() find_apt } + function find_brew() + { + BREW_PATH=`which brew 2>/dev/null` + + if [[ -f $BREW_PATH ]] + then + check "$($BREW_PATH -v)" + isBrew=true + depFound=$((depFound+1)) + else + uncheck "Homebrew is missing" + isBrew=false + + INSTALL_FILES+="${blue}${dim}==> Homebrew:${reset}\n" + INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/bin/brew\n" + INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/Library\n" + INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/share/man/man1/brew.1\n" + fi + + depCount=$((depCount+1)) + } + + function find_ruby() + { + depCount=$((depCount+1)) + + RUBY_PATH=`which ruby 2>/dev/null` + + if [[ -f $RUBY_PATH ]] + then + RUBY_VERSION=`ruby -e "print RUBY_VERSION"` + check "Ruby ${RUBY_VERSION}" + isRuby=true + depFound=$((depFound+1)) + else + uncheck "Ruby is missing 🔥" + isRuby=false + canContinue=false + errorMessages+="${red}==>${reset} ${b}Couldn't find Ruby:${reset} Brew requires Ruby which could not be found.\n" + errorMessages+=" Please install Ruby using these instructions ${u}${blue}https://www.ruby-lang.org/en/documentation/installation/${reset}.\n" + fi + } + function find_rocksdb() { depCount=$((depCount+1)) if [[ $(ldconfig -v 2>/dev/null | grep rocksdb | wc -l) == 1 ]]; then depFound=$((depFound+1)) - check "apt-get" + check "librocksdb" isRocksDB=true else uncheck "librocksdb is missing" @@ -435,6 +520,7 @@ function run_installer() rm $file } + function osx_installer() { info "Adding ethcore repository" From 472019471ee2fb9f958bc24552bc0b3dc7e6e529 Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 15:59:07 +0000 Subject: [PATCH 25/36] debug deb --- install-parity.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install-parity.sh b/install-parity.sh index 159a99dbc..ff43c4e9d 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash - -GET_DEPS_URL=http://get-deps.ethcore.io #PARITY_DEB_URL=https://github.com/ethcore/parity/releases/download/beta-0.9/parity_0.9.0-0_amd64.deb PARITY_DEB_URL=https://github.com/jesuscript/scripts/raw/master/parity_0.9.0-0_amd64.deb @@ -572,6 +570,9 @@ function run_installer() # install ethereum & install dependencies sudo apt-get install -y -qq build-essential git unzip wget nodejs ntp cloud-utils + sudo apt-get -f install + sudo apt-get install -y -qq npm + # add node symlink if it doesn't exist [[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node From 24c85d928b1029cb857626d03eb37d4e6a9479fd Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 16:04:40 +0000 Subject: [PATCH 26/36] debugging npm install --- install-parity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-parity.sh b/install-parity.sh index ff43c4e9d..a06fac771 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -567,10 +567,10 @@ function run_installer() curl -sL https://deb.nodesource.com/setup_0.12 | bash - sudo apt-get update + #sudo apt-get -f -y install # install ethereum & install dependencies sudo apt-get install -y -qq build-essential git unzip wget nodejs ntp cloud-utils - sudo apt-get -f install sudo apt-get install -y -qq npm # add node symlink if it doesn't exist From cc898a4b3b08a8d80aa2e3b03d547e721795e0df Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 16:07:43 +0000 Subject: [PATCH 27/36] debugging npm --- install-parity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-parity.sh b/install-parity.sh index a06fac771..ed57b011a 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -567,7 +567,7 @@ function run_installer() curl -sL https://deb.nodesource.com/setup_0.12 | bash - sudo apt-get update - #sudo apt-get -f -y install + # install ethereum & install dependencies sudo apt-get install -y -qq build-essential git unzip wget nodejs ntp cloud-utils From dc3d1c50986a845500ea966e87790bbb82f42d6b Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 17:01:35 +0000 Subject: [PATCH 28/36] bump rocksdb to 4.2 --- install-deps.sh | 2 +- install-parity.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/install-deps.sh b/install-deps.sh index bae8fc9a6..d6b5064a2 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -535,7 +535,7 @@ function run_installer() else oldpwd=`pwd` cd /tmp - exe git clone --branch v4.1 --depth=1 https://github.com/facebook/rocksdb.git + exe git clone --branch v4.2 --depth=1 https://github.com/facebook/rocksdb.git cd rocksdb exe make shared_lib sudo cp -a librocksdb.so* /usr/lib diff --git a/install-parity.sh b/install-parity.sh index ed57b011a..afe4e658b 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -420,7 +420,7 @@ function run_installer() else oldpwd=`pwd` cd /tmp - exe git clone --branch v4.1 --depth=1 https://github.com/facebook/rocksdb.git + exe git clone --branch v4.2 --depth=1 https://github.com/facebook/rocksdb.git cd rocksdb exe make shared_lib sudo cp -a librocksdb.so* /usr/lib From 39500cf59c38499ff107df5b1d7b38db4ea74769 Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 17:05:50 +0000 Subject: [PATCH 29/36] fixed prompt to install --- install-parity.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/install-parity.sh b/install-parity.sh index afe4e658b..b405eef7e 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -664,11 +664,16 @@ EOL head "${b}OK,${reset} let's install Parity now!" - wait_for_user "${b}Last chance!${reset} Sure you want to install this software?" + if wait_for_user "${b}Last chance!${reset} Sure you want to install this software?" + then + install + echo + echo + else + finish + fi - echo - echo - install + if [[ $OS_TYPE == "linux" ]] then From 183ddbc4da97a4ca6a226dfc0ec7f429299e1ae1 Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 17:23:12 +0000 Subject: [PATCH 30/36] revert parity deb url back to release value --- install-parity.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install-parity.sh b/install-parity.sh index b405eef7e..5f5607b58 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -#PARITY_DEB_URL=https://github.com/ethcore/parity/releases/download/beta-0.9/parity_0.9.0-0_amd64.deb -PARITY_DEB_URL=https://github.com/jesuscript/scripts/raw/master/parity_0.9.0-0_amd64.deb +PARITY_DEB_URL=https://github.com/ethcore/parity/releases/download/beta-0.9/parity_0.9.0-0_amd64.deb + function run_installer() { From 13c20ead1d95fd7e07d743455202d60f3e5e54be Mon Sep 17 00:00:00 2001 From: KKudryavtsev Date: Fri, 5 Feb 2016 17:26:09 +0000 Subject: [PATCH 31/36] tabified --- install-parity.sh | 994 +++++++++++++++++++++++----------------------- 1 file changed, 497 insertions(+), 497 deletions(-) diff --git a/install-parity.sh b/install-parity.sh index 5f5607b58..51eb806eb 100755 --- a/install-parity.sh +++ b/install-parity.sh @@ -5,154 +5,154 @@ PARITY_DEB_URL=https://github.com/ethcore/parity/releases/download/beta-0.9/pari function run_installer() { - ####### Init vars - - HOMEBREW_PREFIX=/usr/local - HOMEBREW_CACHE=/Library/Caches/Homebrew - HOMEBREW_REPO=https://github.com/Homebrew/homebrew - OSX_REQUIERED_VERSION="10.7.0" - - declare OS_TYPE - declare OSX_VERSION - declare GIT_PATH - declare RUBY_PATH - declare BREW_PATH - declare INSTALL_FILES="" + ####### Init vars + + HOMEBREW_PREFIX=/usr/local + HOMEBREW_CACHE=/Library/Caches/Homebrew + HOMEBREW_REPO=https://github.com/Homebrew/homebrew + OSX_REQUIERED_VERSION="10.7.0" + + declare OS_TYPE + declare OSX_VERSION + declare GIT_PATH + declare RUBY_PATH + declare BREW_PATH + declare INSTALL_FILES="" - errorMessages="" - isOsVersion=false - isGit=false - isRuby=false - isBrew=false - canContinue=true - depCount=0 - depFound=0 + errorMessages="" + isOsVersion=false + isGit=false + isRuby=false + isBrew=false + canContinue=true + depCount=0 + depFound=0 - - ####### Setup colors + + ####### Setup colors - red=`tput setaf 1` - green=`tput setaf 2` - yellow=`tput setaf 3` - blue=`tput setaf 4` - magenta=`tput setaf 5` - cyan=`tput setaf 6` - white=`tput setaf 7` - b=`tput bold` - u=`tput sgr 0 1` - ul=`tput smul` - xl=`tput rmul` - stou=`tput smso` - xtou=`tput rmso` - dim=`tput dim` - reverse=`tput rev` - reset=`tput sgr0` + red=`tput setaf 1` + green=`tput setaf 2` + yellow=`tput setaf 3` + blue=`tput setaf 4` + magenta=`tput setaf 5` + cyan=`tput setaf 6` + white=`tput setaf 7` + b=`tput bold` + u=`tput sgr 0 1` + ul=`tput smul` + xl=`tput rmul` + stou=`tput smso` + xtou=`tput rmso` + dim=`tput dim` + reverse=`tput rev` + reset=`tput sgr0` - function head() { - echo "${blue}${b}==>${white} $1${reset}" - } + function head() { + echo "${blue}${b}==>${white} $1${reset}" + } - function info() { - echo "${blue}${b}==>${reset} $1" - } + function info() { + echo "${blue}${b}==>${reset} $1" + } - function successHeading() { - echo "${green}${b}==> $1${reset}" - } + function successHeading() { + echo "${green}${b}==> $1${reset}" + } - function success() { - echo "${green}${b}==>${reset}${green} $1${reset}" - } + function success() { + echo "${green}${b}==>${reset}${green} $1${reset}" + } - function error() { - echo "${red}==> ${u}${b}${red}$1${reset}" - } + function error() { + echo "${red}==> ${u}${b}${red}$1${reset}" + } - function smallError() { - echo "${red}==>${reset} $1" - } + function smallError() { + echo "${red}==>${reset} $1" + } - function green() { - echo "${green}$1${reset}" - } + function green() { + echo "${green}$1${reset}" + } - function red() { - echo "${red}$1${reset}" - } + function red() { + echo "${red}$1${reset}" + } - function check() { - echo "${green}${bold} ✓${reset} $1${reset}" - } + function check() { + echo "${green}${bold} ✓${reset} $1${reset}" + } - function uncheck() { - echo "${red}${bold} ✘${reset} $1${reset}" - } + function uncheck() { + echo "${red}${bold} ✘${reset} $1${reset}" + } - ####### Setup methods + ####### Setup methods - function wait_for_user() { - while : - do - read -p "${blue}==>${reset} $1 [Y/n] " imp - case $imp in - [yY] ) return 0; break ;; - '' ) echo; break ;; - [nN] ) return 1 ;; - * ) echo "Unrecognized option provided. Please provide either 'Y' or 'N'"; - esac - done - } + function wait_for_user() { + while : + do + read -p "${blue}==>${reset} $1 [Y/n] " imp + case $imp in + [yY] ) return 0; break ;; + '' ) echo; break ;; + [nN] ) return 1 ;; + * ) echo "Unrecognized option provided. Please provide either 'Y' or 'N'"; + esac + done + } - function prompt_for_input() { - while : - do - read -p "$1 " imp - echo $imp - return - done - } - - function exe() { - echo "\$ $@"; "$@" - } - - function detectOS() { - if [[ "$OSTYPE" == "linux-gnu" ]] - then - OS_TYPE="linux" - get_linux_dependencies - elif [[ "$OSTYPE" == "darwin"* ]] - then - OS_TYPE="osx" - get_osx_dependencies - else - OS_TYPE="win" - abortInstall "${red}==>${reset} ${b}OS not supported:${reset} parity one-liner currently support OS X and Linux.\nFor instructions on installing parity on other platforms please visit ${u}${blue}http://ethcore.io/${reset}" - fi + function prompt_for_input() { + while : + do + read -p "$1 " imp + echo $imp + return + done + } + + function exe() { + echo "\$ $@"; "$@" + } + + function detectOS() { + if [[ "$OSTYPE" == "linux-gnu" ]] + then + OS_TYPE="linux" + get_linux_dependencies + elif [[ "$OSTYPE" == "darwin"* ]] + then + OS_TYPE="osx" + get_osx_dependencies + else + OS_TYPE="win" + abortInstall "${red}==>${reset} ${b}OS not supported:${reset} parity one-liner currently support OS X and Linux.\nFor instructions on installing parity on other platforms please visit ${u}${blue}http://ethcore.io/${reset}" + fi - echo + echo - if [[ $depCount == $depFound ]] - then - green "Found all dependencies ($depFound/$depCount)" - else - if [[ $canContinue == true ]] - then - red "Some dependencies are missing ($depFound/$depCount)" - elif [[ $canContinue == false && $depFound == 0 ]] - then - red "All dependencies are missing and cannot be auto-installed ($depFound/$depCount)" - abortInstall "$errorMessages"; - elif [[ $canContinue == false ]] - then - red "Some dependencies which cannot be auto-installed are missing ($depFound/$depCount)" - abortInstall "$errorMessages"; - fi - fi - } + if [[ $depCount == $depFound ]] + then + green "Found all dependencies ($depFound/$depCount)" + else + if [[ $canContinue == true ]] + then + red "Some dependencies are missing ($depFound/$depCount)" + elif [[ $canContinue == false && $depFound == 0 ]] + then + red "All dependencies are missing and cannot be auto-installed ($depFound/$depCount)" + abortInstall "$errorMessages"; + elif [[ $canContinue == false ]] + then + red "Some dependencies which cannot be auto-installed are missing ($depFound/$depCount)" + abortInstall "$errorMessages"; + fi + fi + } function macos_version() { @@ -185,7 +185,7 @@ function run_installer() fi errorMessages+="${red}==>${reset} ${b}Mac OS version too old:${reset} eth requires OS X version ${red}$OSX_REQUIERED_VERSION${reset} at least in order to run.\n" - errorMessages+=" Please update the OS and reload the install process.\n" + errorMessages+=" Please update the OS and reload the install process.\n" } function get_osx_dependencies() @@ -196,38 +196,38 @@ function run_installer() find_brew } - function linux_version() - { - source /etc/lsb-release - - if [[ $DISTRIB_ID == "Ubuntu" ]]; then - if [[ $DISTRIB_RELEASE == "14.04" ]]; then - check "Ubuntu-14.04" - isUbuntu1404=true - else - check "Ubuntu, but not 14.04" - isUbuntu1404=false - fi - else - check "Ubuntu not found" - isUbuntu1404=false - fi - } + function linux_version() + { + source /etc/lsb-release + + if [[ $DISTRIB_ID == "Ubuntu" ]]; then + if [[ $DISTRIB_RELEASE == "14.04" ]]; then + check "Ubuntu-14.04" + isUbuntu1404=true + else + check "Ubuntu, but not 14.04" + isUbuntu1404=false + fi + else + check "Ubuntu not found" + isUbuntu1404=false + fi + } - function get_linux_dependencies() - { - linux_version + function get_linux_dependencies() + { + linux_version - find_multirust - find_rocksdb + find_multirust + find_rocksdb - find_curl - find_git - find_make - find_gcc + find_curl + find_git + find_make + find_gcc - find_apt - } + find_apt + } function find_brew() { @@ -243,9 +243,9 @@ function run_installer() isBrew=false INSTALL_FILES+="${blue}${dim}==> Homebrew:${reset}\n" - INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/bin/brew\n" - INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/Library\n" - INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/share/man/man1/brew.1\n" + INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/bin/brew\n" + INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/Library\n" + INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/share/man/man1/brew.1\n" fi depCount=$((depCount+1)) @@ -268,245 +268,245 @@ function run_installer() isRuby=false canContinue=false errorMessages+="${red}==>${reset} ${b}Couldn't find Ruby:${reset} Brew requires Ruby which could not be found.\n" - errorMessages+=" Please install Ruby using these instructions ${u}${blue}https://www.ruby-lang.org/en/documentation/installation/${reset}.\n" + errorMessages+=" Please install Ruby using these instructions ${u}${blue}https://www.ruby-lang.org/en/documentation/installation/${reset}.\n" fi } - function find_rocksdb() - { - depCount=$((depCount+1)) - if [[ $(ldconfig -v 2>/dev/null | grep rocksdb | wc -l) == 1 ]]; then - depFound=$((depFound+1)) - check "librocksdb" - isRocksDB=true - else - uncheck "librocksdb is missing" - isRocksDB=false - INSTALL_FILES+="${blue}${dim}==>${reset}\tlibrocksdb\n" - fi - } + function find_rocksdb() + { + depCount=$((depCount+1)) + if [[ $(ldconfig -v 2>/dev/null | grep rocksdb | wc -l) == 1 ]]; then + depFound=$((depFound+1)) + check "librocksdb" + isRocksDB=true + else + uncheck "librocksdb is missing" + isRocksDB=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tlibrocksdb\n" + fi + } - function find_multirust() - { - depCount=$((depCount+2)) - MULTIRUST_PATH=`which multirust 2>/dev/null` - if [[ -f $MULTIRUST_PATH ]]; then - depFound=$((depFound+1)) - check "multirust" - isMultirust=true - if [[ $(multirust show-default 2>/dev/null | grep nightly | wc -l) == 4 ]]; then - depFound=$((depFound+1)) - check "rust nightly" - isMultirustNightly=true - else - uncheck "rust is not nightly" - isMultirustNightly=false - INSTALL_FILES+="${blue}${dim}==>${reset}\tmultirust -> rust nightly\n" - fi - else - uncheck "multirust is missing" - uncheck "rust nightly is missing" - isMultirust=false - isMultirustNightly=false - INSTALL_FILES+="${blue}${dim}==>${reset}\tmultirust\n" - fi - } + function find_multirust() + { + depCount=$((depCount+2)) + MULTIRUST_PATH=`which multirust 2>/dev/null` + if [[ -f $MULTIRUST_PATH ]]; then + depFound=$((depFound+1)) + check "multirust" + isMultirust=true + if [[ $(multirust show-default 2>/dev/null | grep nightly | wc -l) == 4 ]]; then + depFound=$((depFound+1)) + check "rust nightly" + isMultirustNightly=true + else + uncheck "rust is not nightly" + isMultirustNightly=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tmultirust -> rust nightly\n" + fi + else + uncheck "multirust is missing" + uncheck "rust nightly is missing" + isMultirust=false + isMultirustNightly=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tmultirust\n" + fi + } - function find_apt() - { - depCount=$((depCount+1)) + function find_apt() + { + depCount=$((depCount+1)) - APT_PATH=`which apt-get 2>/dev/null` + APT_PATH=`which apt-get 2>/dev/null` - if [[ -f $APT_PATH ]] - then - depFound=$((depFound+1)) - check "apt-get" - isApt=true - else - uncheck "apt-get is missing" - isApt=false + if [[ -f $APT_PATH ]] + then + depFound=$((depFound+1)) + check "apt-get" + isApt=true + else + uncheck "apt-get is missing" + isApt=false - if [[ $isGCC == false || $isGit == false || $isMake == false || $isCurl == false ]]; then - canContinue=false - errorMessages+="${red}==>${reset} ${b}Couldn't find apt-get:${reset} We can only use apt-get in order to grab our dependencies.\n" - errorMessages+=" Please switch to a distribution such as Debian or Ubuntu or manually install the missing packages.\n" - fi - fi - } + if [[ $isGCC == false || $isGit == false || $isMake == false || $isCurl == false ]]; then + canContinue=false + errorMessages+="${red}==>${reset} ${b}Couldn't find apt-get:${reset} We can only use apt-get in order to grab our dependencies.\n" + errorMessages+=" Please switch to a distribution such as Debian or Ubuntu or manually install the missing packages.\n" + fi + fi + } - function find_gcc() - { - depCount=$((depCount+1)) - GCC_PATH=`which g++ 2>/dev/null` + function find_gcc() + { + depCount=$((depCount+1)) + GCC_PATH=`which g++ 2>/dev/null` - if [[ -f $GCC_PATH ]] - then - depFound=$((depFound+1)) - check "g++" - isGCC=true - else - uncheck "g++ is missing" - isGCC=false - INSTALL_FILES+="${blue}${dim}==>${reset}\tg++\n" - fi - } + if [[ -f $GCC_PATH ]] + then + depFound=$((depFound+1)) + check "g++" + isGCC=true + else + uncheck "g++ is missing" + isGCC=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tg++\n" + fi + } - function find_git() - { - depCount=$((depCount+1)) - GIT_PATH=`which git 2>/dev/null` + function find_git() + { + depCount=$((depCount+1)) + GIT_PATH=`which git 2>/dev/null` - if [[ -f $GIT_PATH ]] - then - depFound=$((depFound+1)) - check "git" - isGit=true - else - uncheck "git is missing" - isGit=false - INSTALL_FILES+="${blue}${dim}==>${reset}\tgit\n" - fi - } + if [[ -f $GIT_PATH ]] + then + depFound=$((depFound+1)) + check "git" + isGit=true + else + uncheck "git is missing" + isGit=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tgit\n" + fi + } - function find_make() - { - depCount=$((depCount+1)) - MAKE_PATH=`which make 2>/dev/null` + function find_make() + { + depCount=$((depCount+1)) + MAKE_PATH=`which make 2>/dev/null` - if [[ -f $MAKE_PATH ]] - then - depFound=$((depFound+1)) - check "make" - isMake=true - else - uncheck "make is missing" - isMake=false - INSTALL_FILES+="${blue}${dim}==>${reset}\tmake\n" - fi - } + if [[ -f $MAKE_PATH ]] + then + depFound=$((depFound+1)) + check "make" + isMake=true + else + uncheck "make is missing" + isMake=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tmake\n" + fi + } - function find_curl() - { - depCount=$((depCount+1)) - CURL_PATH=`which curl 2>/dev/null` + function find_curl() + { + depCount=$((depCount+1)) + CURL_PATH=`which curl 2>/dev/null` - if [[ -f $CURL_PATH ]] - then - depFound=$((depFound+1)) - check "curl" - isCurl=true - else - uncheck "curl is missing" - isCurl=false - INSTALL_FILES+="${blue}${dim}==>${reset}\tcurl\n" - fi - } + if [[ -f $CURL_PATH ]] + then + depFound=$((depFound+1)) + check "curl" + isCurl=true + else + uncheck "curl is missing" + isCurl=false + INSTALL_FILES+="${blue}${dim}==>${reset}\tcurl\n" + fi + } - function ubuntu1404_rocksdb_installer() - { - sudo apt-get update -qq - sudo apt-get install -qq -y software-properties-common - sudo apt-add-repository -y ppa:giskou/librocksdb - sudo apt-get -f -y install - sudo apt-get update -qq - sudo apt-get install -qq -y librocksdb - } + function ubuntu1404_rocksdb_installer() + { + sudo apt-get update -qq + sudo apt-get install -qq -y software-properties-common + sudo apt-add-repository -y ppa:giskou/librocksdb + sudo apt-get -f -y install + sudo apt-get update -qq + sudo apt-get install -qq -y librocksdb + } - function linux_rocksdb_installer() - { - if [[ $isUbuntu1404 == true ]]; then - ubuntu1404_rocksdb_installer - else - oldpwd=`pwd` - cd /tmp - exe git clone --branch v4.2 --depth=1 https://github.com/facebook/rocksdb.git - cd rocksdb - exe make shared_lib - sudo cp -a librocksdb.so* /usr/lib - sudo ldconfig - cd /tmp - rm -rf /tmp/rocksdb - cd $oldpwd - fi - } + function linux_rocksdb_installer() + { + if [[ $isUbuntu1404 == true ]]; then + ubuntu1404_rocksdb_installer + else + oldpwd=`pwd` + cd /tmp + exe git clone --branch v4.2 --depth=1 https://github.com/facebook/rocksdb.git + cd rocksdb + exe make shared_lib + sudo cp -a librocksdb.so* /usr/lib + sudo ldconfig + cd /tmp + rm -rf /tmp/rocksdb + cd $oldpwd + fi + } - function verify_installation() - { - ETH_PATH=`which parity 2>/dev/null` + function verify_installation() + { + ETH_PATH=`which parity 2>/dev/null` - if [[ -f $ETH_PATH ]] - then - success "Parity has been installed" - else - error "Parity is missing" - abortInstall - fi - } + if [[ -f $ETH_PATH ]] + then + success "Parity has been installed" + else + error "Parity is missing" + abortInstall + fi + } - function verify_dep_installation() - { - info "Verifying installation" + function verify_dep_installation() + { + info "Verifying installation" - if [[ $OS_TYPE == "linux" ]]; then - find_curl - find_git - find_make - find_gcc - find_rocksdb - find_multirust + if [[ $OS_TYPE == "linux" ]]; then + find_curl + find_git + find_make + find_gcc + find_rocksdb + find_multirust - if [[ $isCurl == false || $isGit == false || $isMake == false || $isGCC == false || $isRocksDB == false || $isMultirustNightly == false ]]; then - abortInstall - fi - fi - } + if [[ $isCurl == false || $isGit == false || $isMake == false || $isGCC == false || $isRocksDB == false || $isMultirustNightly == false ]]; then + abortInstall + fi + fi + } - function linux_deps_installer() - { - if [[ $isGCC == false || $isGit == false || $isMake == false || $isCurl == false ]]; then - info "Installing build dependencies..." - sudo apt-get update -qq - if [[ $isGit == false ]]; then - sudo apt-get install -q -y git - fi - if [[ $isGCC == false ]]; then - sudo apt-get install -q -y g++ gcc - fi - if [[ $isMake == false ]]; then - sudo apt-get install -q -y make - fi - if [[ $isCurl == false ]]; then - sudo apt-get install -q -y curl - fi - echo - fi - - if [[ $isRocksDB == false ]]; then - info "Installing rocksdb..." - linux_rocksdb_installer - echo - fi - - if [[ $isMultirust == false ]]; then - info "Installing multirust..." - curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sudo sh -s -- --yes - echo - fi - - if [[ $isMultirustNightly == false ]]; then - info "Installing rust nightly..." - sudo multirust update nightly - sudo multirust default nightly - echo + function linux_deps_installer() + { + if [[ $isGCC == false || $isGit == false || $isMake == false || $isCurl == false ]]; then + info "Installing build dependencies..." + sudo apt-get update -qq + if [[ $isGit == false ]]; then + sudo apt-get install -q -y git + fi + if [[ $isGCC == false ]]; then + sudo apt-get install -q -y g++ gcc + fi + if [[ $isMake == false ]]; then + sudo apt-get install -q -y make + fi + if [[ $isCurl == false ]]; then + sudo apt-get install -q -y curl + fi + echo fi - } + if [[ $isRocksDB == false ]]; then + info "Installing rocksdb..." + linux_rocksdb_installer + echo + fi + + if [[ $isMultirust == false ]]; then + info "Installing multirust..." + curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sudo sh -s -- --yes + echo + fi + + if [[ $isMultirustNightly == false ]]; then + info "Installing rust nightly..." + sudo multirust update nightly + sudo multirust default nightly + echo + fi + + } - function linux_installer() - { + function linux_installer() + { linux_deps_installer verify_dep_installation @@ -516,154 +516,154 @@ function run_installer() wget $PARITY_DEB_URL -qO $file sudo dpkg -i $file rm $file - } + } - function osx_installer() - { - info "Adding ethcore repository" - brew tap ethcore/ethcore https://github.com/ethcore/homebrew-ethcore.git - echo + function osx_installer() + { + info "Adding ethcore repository" + brew tap ethcore/ethcore https://github.com/ethcore/homebrew-ethcore.git + echo - info "Updating brew" - brew update - echo + info "Updating brew" + brew update + echo - info "Installing parity" - if [[ $isEth == true ]] - then - brew reinstall parity - else - brew install parity - brew linkapps parity - fi - echo - } + info "Installing parity" + if [[ $isEth == true ]] + then + brew reinstall parity + else + brew install parity + brew linkapps parity + fi + echo + } - function install() - { - echo - head "Installing Parity build dependencies" + function install() + { + echo + head "Installing Parity build dependencies" - if [[ $OS_TYPE == "osx" ]] - then - osx_installer - elif [[ $OS_TYPE == "linux" ]] - then - linux_installer - fi + if [[ $OS_TYPE == "osx" ]] + then + osx_installer + elif [[ $OS_TYPE == "linux" ]] + then + linux_installer + fi verify_installation - } + } - - function install_netstats() - { - echo "Installing netstats" + + function install_netstats() + { + echo "Installing netstats" - secret=$(prompt_for_input "Please enter the netstats secret:") - instance_name=$(prompt_for_input "Please enter your instance name:") - contact_details=$(prompt_for_input "Please enter your contact details (optional):") + secret=$(prompt_for_input "Please enter the netstats secret:") + instance_name=$(prompt_for_input "Please enter your instance name:") + contact_details=$(prompt_for_input "Please enter your contact details (optional):") - curl -sL https://deb.nodesource.com/setup_0.12 | bash - - sudo apt-get update + curl -sL https://deb.nodesource.com/setup_0.12 | bash - + sudo apt-get update - # install ethereum & install dependencies - sudo apt-get install -y -qq build-essential git unzip wget nodejs ntp cloud-utils + # install ethereum & install dependencies + sudo apt-get install -y -qq build-essential git unzip wget nodejs ntp cloud-utils sudo apt-get install -y -qq npm - # add node symlink if it doesn't exist - [[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node + # add node symlink if it doesn't exist + [[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node - # set up time update cronjob - sudo bash -c "cat > /etc/cron.hourly/ntpdate << EOF - #!/bin/sh - pm2 flush - sudo service ntp stop - sudo ntpdate -s ntp.ubuntu.com - sudo service ntp start - EOF" + # set up time update cronjob + sudo bash -c "cat > /etc/cron.hourly/ntpdate << EOF + #!/bin/sh + pm2 flush + sudo service ntp stop + sudo ntpdate -s ntp.ubuntu.com + sudo service ntp start + EOF" - sudo chmod 755 /etc/cron.hourly/ntpdate + sudo chmod 755 /etc/cron.hourly/ntpdate cd $HOME - [ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api netstats - oldpwd= $(pwd) - cd netstats - git pull - git checkout 95d595258239a0fdf56b97dedcfb2be62f6170e6 + [ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api netstats + oldpwd= $(pwd) + cd netstats + git pull + git checkout 95d595258239a0fdf56b97dedcfb2be62f6170e6 - sudo npm install - sudo npm install pm2 -g + sudo npm install + sudo npm install pm2 -g - cat > app.json << EOL + cat > app.json << EOL [ - { - "name" : "node-app", - "script" : "app.js", - "log_date_format" : "YYYY-MM-DD HH:mm Z", - "merge_logs" : false, - "watch" : false, - "max_restarts" : 10, - "exec_interpreter" : "node", - "exec_mode" : "fork_mode", - "env": - { - "NODE_ENV" : "production", - "RPC_HOST" : "localhost", - "RPC_PORT" : "8545", - "LISTENING_PORT" : "30303", - "INSTANCE_NAME" : "${instance_name}", - "CONTACT_DETAILS" : "${contact_details}", - "WS_SERVER" : "wss://rpc.ethstats.net", - "WS_SECRET" : "${secret}", - "VERBOSITY" : 2 - - } - } + { + "name" : "node-app", + "script" : "app.js", + "log_date_format" : "YYYY-MM-DD HH:mm Z", + "merge_logs" : false, + "watch" : false, + "max_restarts" : 10, + "exec_interpreter" : "node", + "exec_mode" : "fork_mode", + "env": + { + "NODE_ENV" : "production", + "RPC_HOST" : "localhost", + "RPC_PORT" : "8545", + "LISTENING_PORT" : "30303", + "INSTANCE_NAME" : "${instance_name}", + "CONTACT_DETAILS" : "${contact_details}", + "WS_SERVER" : "wss://rpc.ethstats.net", + "WS_SECRET" : "${secret}", + "VERBOSITY" : 2 + + } + } ] EOL - pm2 startOrRestart app.json - cd $oldpwd - } - + pm2 startOrRestart app.json + cd $oldpwd + } + - function abortInstall() - { - echo - error "Installation failed" - echo -e "$1" - echo - exit 0 - } + function abortInstall() + { + echo + error "Installation failed" + echo -e "$1" + echo + exit 0 + } - function finish() - { - echo - successHeading "All done" - # head "Next steps" - # info "Run ${cyan}\`\`${reset} to get started.${reset}" - echo - exit 0 - } + function finish() + { + echo + successHeading "All done" + # head "Next steps" + # info "Run ${cyan}\`\`${reset} to get started.${reset}" + echo + exit 0 + } - head "Checking OS dependencies" - detectOS + head "Checking OS dependencies" + detectOS - if [[ $INSTALL_FILES != "" ]]; then - echo - head "In addition to the Parity build dependencies, this script will install:" - printf "$INSTALL_FILES" - echo - fi + if [[ $INSTALL_FILES != "" ]]; then + echo + head "In addition to the Parity build dependencies, this script will install:" + printf "$INSTALL_FILES" + echo + fi - #DEBUG + #DEBUG - - head "${b}OK,${reset} let's install Parity now!" + + head "${b}OK,${reset} let's install Parity now!" if wait_for_user "${b}Last chance!${reset} Sure you want to install this software?" then install @@ -673,21 +673,21 @@ EOL finish fi - + - if [[ $OS_TYPE == "linux" ]] - then - echo "Netstats:" - head "Would you like to install and configure a netstats client?" - if wait_for_user "${b}OK,${reset} let's go!" - then - install_netstats - fi - fi + if [[ $OS_TYPE == "linux" ]] + then + echo "Netstats:" + head "Would you like to install and configure a netstats client?" + if wait_for_user "${b}OK,${reset} let's go!" + then + install_netstats + fi + fi - # Display goodbye message - finish + # Display goodbye message + finish } run_installer From d2656c6991fee3304e7155f22619af070bec77a2 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 6 Feb 2016 14:10:20 +0100 Subject: [PATCH 32/36] install-deps uses the new repo for rocksdb. --- install-deps.sh | 51 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/install-deps.sh b/install-deps.sh index 15fdc838c..afc64b259 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -118,6 +118,14 @@ function run_installer() echo "\$ $@"; "$@" } + function sudo() { + if $isSudo; then + `which sudo` "$@" + else + "$@" + fi + } + function detectOS() { if [[ "$OSTYPE" == "linux-gnu" ]] then @@ -359,16 +367,16 @@ function run_installer() source /etc/lsb-release if [[ $DISTRIB_ID == "Ubuntu" ]]; then - if [[ $DISTRIB_RELEASE == "14.04" ]]; then - check "Ubuntu-14.04" - isUbuntu1404=true + if [[ $DISTRIB_RELEASE == "14.04" || $DISTRIB_RELEASE == "15.04" || $DISTRIB_RELEASE == "15.10" ]]; then + check "Ubuntu" + isUbuntu=true else - check "Ubuntu, but not 14.04" - isUbuntu1404=false + check "Ubuntu, but version not supported" + isUbuntu=false fi else check "Ubuntu not found" - isUbuntu1404=false + isUbuntu=false fi } @@ -384,6 +392,7 @@ function run_installer() find_make find_gcc + find_sudo find_apt } @@ -467,6 +476,28 @@ function run_installer() fi } + function find_sudo() + { + if [[ `whoami` == "root" ]]; then + isSudo=false + else + depCount=$((depCount+1)) + SUDO_PATH=`which sudo 2>/dev/null` + + if [[ -f $SUDO_PATH ]] + then + depFound=$((depFound+1)) + check "sudo" + isSudo=true + else + uncheck "sudo is missing" + canContinue=false + errorMessages+="${red}==>${reset} ${b}Couldn't find sudo:${reset} Root access is needed for parts of this installation.\n" + errorMessages+=" Please ensure you have sudo installed or alternatively run this script as root.\n" + fi + fi + } + function find_git() { depCount=$((depCount+1)) @@ -518,11 +549,11 @@ function run_installer() fi } - function ubuntu1404_rocksdb_installer() + function ubuntu_rocksdb_installer() { sudo apt-get update -qq sudo apt-get install -qq -y software-properties-common - sudo apt-add-repository -y ppa:giskou/librocksdb + sudo apt-add-repository -y ppa:ethcore/ethcore sudo apt-get -f -y install sudo apt-get update -qq sudo apt-get install -qq -y librocksdb @@ -530,8 +561,8 @@ function run_installer() function linux_rocksdb_installer() { - if [[ $isUbuntu1404 == true ]]; then - ubuntu1404_rocksdb_installer + if [[ $isUbuntu == true ]]; then + ubuntu_rocksdb_installer else oldpwd=`pwd` cd /tmp From 123b0013129352968ab60fba1cd0a772a822ee90 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 6 Feb 2016 14:28:06 +0100 Subject: [PATCH 33/36] More tweaks to the deps script to manage edge-cases. --- install-deps.sh | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/install-deps.sh b/install-deps.sh index 821fdc2e4..2552056ce 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -137,7 +137,7 @@ function run_installer() get_osx_dependencies else OS_TYPE="win" - abortInstall "${red}==>${reset} ${b}OS not supported:${reset} parity one-liner currently support OS X and Linux.\nFor instructions on installing parity on other platforms please visit ${u}${blue}http://ethcore.io/${reset}" + abortInstall "${red}==>${reset} ${b}OS not supported:${reset} Parity one-liner currently support OS X and Linux.\nFor instructions on installing parity on other platforms please visit ${u}${blue}http://ethcore.io/${reset}" fi echo @@ -392,8 +392,8 @@ function run_installer() find_make find_gcc - find_sudo find_apt + find_sudo } function find_rocksdb() @@ -478,19 +478,25 @@ function run_installer() function find_sudo() { - if [[ `whoami` == "root" ]]; then - isSudo=false - else - depCount=$((depCount+1)) - SUDO_PATH=`which sudo 2>/dev/null` + depCount=$((depCount+1)) + SUDO_PATH=`which sudo 2>/dev/null` - if [[ -f $SUDO_PATH ]] - then - depFound=$((depFound+1)) - check "sudo" - isSudo=true + if [[ -f $SUDO_PATH ]] + then + depFound=$((depFound+1)) + check "sudo" + isSudo=true + else + uncheck "sudo is missing" + if [[ `whoami` == "root" ]]; then + if [[ $isApt == false && $isMultirust == false ]]; then + canContinue=false + errorMessages+="${red}==>${reset} ${b}Couldn't find sudo:${reset} Sudo is needed for the installation of multirust.\n" + errorMessages+=" Please ensure you have sudo installed or alternatively install multirust manually.\n" + fi + + isSudo=false else - uncheck "sudo is missing" canContinue=false errorMessages+="${red}==>${reset} ${b}Couldn't find sudo:${reset} Root access is needed for parts of this installation.\n" errorMessages+=" Please ensure you have sudo installed or alternatively run this script as root.\n" @@ -605,6 +611,9 @@ function run_installer() if [[ $isMultirust == false ]]; then info "Installing multirust..." + if [[ $isSudo == false ]]; then + apt-get install -q -y sudo + fi curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sudo sh -s -- --yes echo fi From e03ba708db874af4dbbb17b1053b01ebd81dae82 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 6 Feb 2016 14:59:37 +0100 Subject: [PATCH 34/36] Better promting. --- install-deps.sh | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/install-deps.sh b/install-deps.sh index 2552056ce..3390c9f7f 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -93,13 +93,19 @@ function run_installer() ####### Setup methods function wait_for_user() { + if [[ $( ask_user "$1" ) == false ]]; then + abort_install "${red}==>${reset} Process stopped by user. To resume the install run the one-liner command again." + fi + } + + function ask_user() { while : do read -p "${blue}==>${reset} $1 [Y/n] " imp case $imp in - [yY] ) echo; break ;; - '' ) echo; break ;; - [nN] ) abortInstall "${red}==>${reset} Process stopped by user. To resume the install run the one-liner command again." ;; + [yY] ) echo true; break ;; + '' ) echo true; break ;; + [nN] ) echo false; break ;; * ) echo "Unrecognized option provided. Please provide either 'Y' or 'N'"; esac done @@ -126,7 +132,7 @@ function run_installer() fi } - function detectOS() { + function detect_os() { if [[ "$OSTYPE" == "linux-gnu" ]] then OS_TYPE="linux" @@ -137,7 +143,7 @@ function run_installer() get_osx_dependencies else OS_TYPE="win" - abortInstall "${red}==>${reset} ${b}OS not supported:${reset} Parity one-liner currently support OS X and Linux.\nFor instructions on installing parity on other platforms please visit ${u}${blue}http://ethcore.io/${reset}" + abort_install "${red}==>${reset} ${b}OS not supported:${reset} Parity one-liner currently support OS X and Linux.\nFor instructions on installing parity on other platforms please visit ${u}${blue}http://ethcore.io/${reset}" fi echo @@ -152,11 +158,11 @@ function run_installer() elif [[ $canContinue == false && $depFound == 0 ]] then red "All dependencies are missing and cannot be auto-installed ($depFound/$depCount)" - abortInstall "$errorMessages"; + abort_install "$errorMessages"; elif [[ $canContinue == false ]] then red "Some dependencies which cannot be auto-installed are missing ($depFound/$depCount)" - abortInstall "$errorMessages"; + abort_install "$errorMessages"; fi fi } @@ -322,7 +328,7 @@ function run_installer() if [[ $isBrew == false ]] then - abortInstall "Couldn't install brew" + abort_install "Couldn't install brew" fi fi } @@ -653,7 +659,7 @@ function run_installer() find_multirust if [[ $isCurl == false || $isGit == false || $isMake == false || $isGCC == false || $isRocksDB == false || $isMultirustNightly == false ]]; then - abortInstall + abort_install fi fi } @@ -749,10 +755,10 @@ EOL cd .. } - function abortInstall() + function abort_install() { echo - error "Installation failed" + error "Installation aborted" echo -e "$1" echo exit 0 @@ -777,7 +783,7 @@ EOL # Check dependencies head "Checking OS dependencies" - detectOS + detect_os if [[ $INSTALL_FILES != "" ]]; then echo @@ -797,14 +803,14 @@ EOL if [[ ! -e parity ]]; then # Maybe install parity - if wait_for_user "${b}Build dependencies installed B-)!${reset} Would you like to download and build parity?"; then + if [[ $(ask_user "${b}Build dependencies installed B-)!${reset} Would you like to download and build parity?") == true ]]; then # Do get parity. build_parity fi fi if [[ $OS_TYPE == "linux" && $DISTRIB_ID == "Ubuntu" ]]; then - if wait_for_user "${b}Netstats:${reset} Would you like to install and configure a netstats client?"; then + if [[ $(ask_user "${b}Netstats:${reset} Would you like to install and configure a netstats client?") == true ]]; then install_netstats fi fi From 87f74065487fd923e292db449b4be6f96ace2ead Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 6 Feb 2016 15:03:44 +0100 Subject: [PATCH 35/36] Fix newline characters. --- install-deps.sh | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/install-deps.sh b/install-deps.sh index 3390c9f7f..df2dee038 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -46,6 +46,7 @@ function run_installer() dim=`tput dim` reverse=`tput rev` reset=`tput sgr0` + n=$'\n' function head() { @@ -143,7 +144,7 @@ function run_installer() get_osx_dependencies else OS_TYPE="win" - abort_install "${red}==>${reset} ${b}OS not supported:${reset} Parity one-liner currently support OS X and Linux.\nFor instructions on installing parity on other platforms please visit ${u}${blue}http://ethcore.io/${reset}" + abort_install "${red}==>${reset} ${b}OS not supported:${reset} Parity one-liner currently support OS X and Linux.${n}For instructions on installing parity on other platforms please visit ${u}${blue}http://ethcore.io/${reset}" fi echo @@ -205,8 +206,8 @@ function run_installer() fi fi - errorMessages+="${red}==>${reset} ${b}Mac OS version too old:${reset} eth requires OS X version ${red}$OSX_REQUIERED_VERSION${reset} at least in order to run.\n" - errorMessages+=" Please update the OS and reload the install process.\n" + errorMessages+="${red}==>${reset} ${b}Mac OS version too old:${reset} eth requires OS X version ${red}$OSX_REQUIERED_VERSION${reset} at least in order to run.${n}" + errorMessages+=" Please update the OS and reload the install process.${n}" } function find_eth() @@ -257,8 +258,8 @@ function run_installer() uncheck "Ruby is missing 🔥" isRuby=false canContinue=false - errorMessages+="${red}==>${reset} ${b}Couldn't find Ruby:${reset} Brew requires Ruby which could not be found.\n" - errorMessages+=" Please install Ruby using these instructions ${u}${blue}https://www.ruby-lang.org/en/documentation/installation/${reset}.\n" + errorMessages+="${red}==>${reset} ${b}Couldn't find Ruby:${reset} Brew requires Ruby which could not be found.${n}" + errorMessages+=" Please install Ruby using these instructions ${u}${blue}https://www.ruby-lang.org/en/documentation/installation/${reset}.${n}" fi } @@ -275,10 +276,10 @@ function run_installer() uncheck "Homebrew is missing" isBrew=false - INSTALL_FILES+="${blue}${dim}==> Homebrew:${reset}\n" - INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/bin/brew\n" - INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/Library\n" - INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/share/man/man1/brew.1\n" + INSTALL_FILES+="${blue}${dim}==> Homebrew:${reset}${n}" + INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/bin/brew${n}" + INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/Library${n}" + INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/share/man/man1/brew.1${n}" fi depCount=$((depCount+1)) @@ -409,10 +410,11 @@ function run_installer() depFound=$((depFound+1)) check "apt-get" isRocksDB=true + INSTALL_FILES+="${blue}${dim}==> librocksdb:${reset}$n" else uncheck "librocksdb is missing" isRocksDB=false - INSTALL_FILES+="${blue}${dim}==> librocksdb:${reset}\n" + INSTALL_FILES+="${blue}${dim}==> librocksdb:${reset}$n" fi } @@ -431,14 +433,14 @@ function run_installer() else uncheck "rust is not nightly" isMultirustNightly=false - INSTALL_FILES+="${blue}${dim}==> multirust -> rust nightly:${reset}\n" + INSTALL_FILES+="${blue}${dim}==> multirust -> rust nightly:${reset}${n}" fi else uncheck "multirust is missing" uncheck "rust nightly is missing" isMultirust=false isMultirustNightly=false - INSTALL_FILES+="${blue}${dim}==> multirust:${reset}\n" + INSTALL_FILES+="${blue}${dim}==> multirust:${reset}${n}" fi } @@ -459,8 +461,8 @@ function run_installer() if [[ $isGCC == false || $isGit == false || $isMake == false || $isCurl == false ]]; then canContinue=false - errorMessages+="${red}==>${reset} ${b}Couldn't find apt-get:${reset} We can only use apt-get in order to grab our dependencies.\n" - errorMessages+=" Please switch to a distribution such as Debian or Ubuntu or manually install the missing packages.\n" + errorMessages+="${red}==>${reset} ${b}Couldn't find apt-get:${reset} We can only use apt-get in order to grab our dependencies.${n}" + errorMessages+=" Please switch to a distribution such as Debian or Ubuntu or manually install the missing packages.${n}" fi fi } @@ -478,7 +480,7 @@ function run_installer() else uncheck "g++ is missing" isGCC=false - INSTALL_FILES+="${blue}${dim}==> g++:${reset}\n" + INSTALL_FILES+="${blue}${dim}==> g++:${reset}${n}" fi } @@ -497,15 +499,15 @@ function run_installer() if [[ `whoami` == "root" ]]; then if [[ $isApt == false && $isMultirust == false ]]; then canContinue=false - errorMessages+="${red}==>${reset} ${b}Couldn't find sudo:${reset} Sudo is needed for the installation of multirust.\n" - errorMessages+=" Please ensure you have sudo installed or alternatively install multirust manually.\n" + errorMessages+="${red}==>${reset} ${b}Couldn't find sudo:${reset} Sudo is needed for the installation of multirust.${n}" + errorMessages+=" Please ensure you have sudo installed or alternatively install multirust manually.${n}" fi isSudo=false else canContinue=false - errorMessages+="${red}==>${reset} ${b}Couldn't find sudo:${reset} Root access is needed for parts of this installation.\n" - errorMessages+=" Please ensure you have sudo installed or alternatively run this script as root.\n" + errorMessages+="${red}==>${reset} ${b}Couldn't find sudo:${reset} Root access is needed for parts of this installation.${n}" + errorMessages+=" Please ensure you have sudo installed or alternatively run this script as root.${n}" fi fi } @@ -523,7 +525,7 @@ function run_installer() else uncheck "git is missing" isGit=false - INSTALL_FILES+="${blue}${dim}==> git:${reset}\n" + INSTALL_FILES+="${blue}${dim}==> git:${reset}${n}" fi } @@ -540,7 +542,7 @@ function run_installer() else uncheck "make is missing" isMake=false - INSTALL_FILES+="${blue}${dim}==> make:${reset}\n" + INSTALL_FILES+="${blue}${dim}==> make:${reset}${n}" fi } @@ -557,7 +559,7 @@ function run_installer() else uncheck "curl is missing" isCurl=false - INSTALL_FILES+="${blue}${dim}==> curl:${reset}\n" + INSTALL_FILES+="${blue}${dim}==> curl:${reset}${n}" fi } From 564a191e365e1c4c4c815d80493945db522f376b Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 6 Feb 2016 15:07:26 +0100 Subject: [PATCH 36/36] Better install text. --- install-deps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install-deps.sh b/install-deps.sh index df2dee038..e784f5b43 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -805,14 +805,14 @@ EOL if [[ ! -e parity ]]; then # Maybe install parity - if [[ $(ask_user "${b}Build dependencies installed B-)!${reset} Would you like to download and build parity?") == true ]]; then + if [[ $(ask_user "${b}Parity${reset} Would you like to download and build parity?") == true ]]; then # Do get parity. build_parity fi fi if [[ $OS_TYPE == "linux" && $DISTRIB_ID == "Ubuntu" ]]; then - if [[ $(ask_user "${b}Netstats:${reset} Would you like to install and configure a netstats client?") == true ]]; then + if [[ $(ask_user "${b}Netstats${reset} Would you like to download, install and configure a Netstats client?${n}${b}${red}WARNING: ${reset}${red}This will need a secret and reconfigure any existing node/NPM installation you have.${reset} ") == true ]]; then install_netstats fi fi