Merge pull request #347 from ethcore/install-parity-unf
install parity script
This commit is contained in:
commit
d7365f8a30
@ -1,5 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PARITY_DEB_URL=https://github.com/ethcore/parity/releases/download/beta-0.9/parity_0.9.0-0_amd64.deb
|
||||||
|
|
||||||
function run_installer()
|
function run_installer()
|
||||||
{
|
{
|
||||||
####### Init vars
|
####### Init vars
|
||||||
@ -22,6 +26,7 @@ function run_installer()
|
|||||||
isGit=false
|
isGit=false
|
||||||
isRuby=false
|
isRuby=false
|
||||||
isBrew=false
|
isBrew=false
|
||||||
|
isDocker=false
|
||||||
canContinue=true
|
canContinue=true
|
||||||
depCount=0
|
depCount=0
|
||||||
depFound=0
|
depFound=0
|
||||||
@ -97,20 +102,24 @@ function run_installer()
|
|||||||
do
|
do
|
||||||
read -p "${blue}==>${reset} $1 [Y/n] " imp
|
read -p "${blue}==>${reset} $1 [Y/n] " imp
|
||||||
case $imp in
|
case $imp in
|
||||||
[yY] ) echo; break ;;
|
[yY] ) return 0; break ;;
|
||||||
'' ) echo; break ;;
|
'' ) echo; break ;;
|
||||||
[nN] ) abortInstall "${red}==>${reset} Process stopped by user. To resume the install run the one-liner command again." ;;
|
[nN] ) return 1 ;;
|
||||||
* ) echo "Unrecognized option provided. Please provide either 'Y' or 'N'";
|
* ) echo "Unrecognized option provided. Please provide either 'Y' or 'N'";
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function prompt_for_input() {
|
||||||
|
while :
|
||||||
function exe() {
|
do
|
||||||
echo "\$ $@"; "$@"
|
read -p "$1 " imp
|
||||||
|
echo $imp
|
||||||
|
return
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function detectOS() {
|
function detectOS() {
|
||||||
if [[ "$OSTYPE" == "linux-gnu" ]]
|
if [[ "$OSTYPE" == "linux-gnu" ]]
|
||||||
then
|
then
|
||||||
@ -195,7 +204,6 @@ function run_installer()
|
|||||||
if [[ -f $ETH_PATH ]]
|
if [[ -f $ETH_PATH ]]
|
||||||
then
|
then
|
||||||
check "Found parity: $ETH_PATH"
|
check "Found parity: $ETH_PATH"
|
||||||
echo "$($ETH_PATH -V)"
|
|
||||||
isEth=true
|
isEth=true
|
||||||
else
|
else
|
||||||
uncheck "parity is missing"
|
uncheck "parity is missing"
|
||||||
@ -317,20 +325,20 @@ function run_installer()
|
|||||||
osx_dependency_installer
|
osx_dependency_installer
|
||||||
|
|
||||||
info "Adding ethcore repository"
|
info "Adding ethcore repository"
|
||||||
exe brew tap ethcore/ethcore git@github.com:ethcore/homebrew-ethcore.git
|
brew tap ethcore/ethcore https://github.com/ethcore/homebrew-ethcore.git
|
||||||
echo
|
echo
|
||||||
|
|
||||||
info "Updating brew"
|
info "Updating brew"
|
||||||
exe brew update
|
brew update
|
||||||
echo
|
echo
|
||||||
|
|
||||||
info "Installing parity"
|
info "Installing parity"
|
||||||
if [[ $isEth == true ]]
|
if [[ $isEth == true ]]
|
||||||
then
|
then
|
||||||
exe brew reinstall parity
|
brew reinstall parity
|
||||||
else
|
else
|
||||||
exe brew install parity
|
brew install parity
|
||||||
exe brew linkapps parity
|
brew linkapps parity
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
@ -356,6 +364,7 @@ function run_installer()
|
|||||||
function get_linux_dependencies()
|
function get_linux_dependencies()
|
||||||
{
|
{
|
||||||
find_apt
|
find_apt
|
||||||
|
find_docker
|
||||||
}
|
}
|
||||||
|
|
||||||
function find_apt()
|
function find_apt()
|
||||||
@ -372,38 +381,96 @@ function run_installer()
|
|||||||
isApt=false
|
isApt=false
|
||||||
fi
|
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()
|
function linux_rocksdb_installer()
|
||||||
{
|
{
|
||||||
oldpwd=`pwd`
|
sudo add-apt-repository -y ppa:giskou/librocksdb
|
||||||
cd /tmp
|
sudo apt-get -f -y install
|
||||||
exe git clone --branch v4.1 --depth=1 https://github.com/facebook/rocksdb.git
|
sudo apt-get update
|
||||||
cd rocksdb
|
sudo apt-get install -y librocksdb
|
||||||
exe make shared_lib
|
|
||||||
sudo cp -a librocksdb.so* /usr/lib
|
|
||||||
sudo ldconfig
|
|
||||||
cd /tmp
|
|
||||||
rm -rf /tmp/rocksdb
|
|
||||||
cd $oldpwd
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function linux_installer()
|
function linux_installer()
|
||||||
{
|
{
|
||||||
info "Installing git"
|
info "Installing dependencies"
|
||||||
sudo apt-get install -q -y git
|
sudo apt-get update && sudo apt-get install -q -y git curl g++ wget
|
||||||
echo
|
echo
|
||||||
|
|
||||||
info "Installing rocksdb"
|
info "Installing rocksdb"
|
||||||
linux_rocksdb_installer
|
linux_rocksdb_installer
|
||||||
echo
|
echo
|
||||||
|
|
||||||
info "Installing multirust"
|
|
||||||
curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sudo sh -s -- --yes
|
|
||||||
sudo multirust update nightly
|
|
||||||
sudo multirust default nightly
|
|
||||||
echo
|
|
||||||
|
|
||||||
info "Installing parity"
|
info "Installing parity"
|
||||||
wget --quiet --output-document=- http://ethcore.io/download/parity.deb | dpkg --install -
|
file=/tmp/parity.deb
|
||||||
|
|
||||||
|
|
||||||
|
wget $PARITY_DEB_URL -qO $file
|
||||||
|
sudo dpkg -i $file
|
||||||
|
rm $file
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_netstats()
|
||||||
|
{
|
||||||
|
echo "install netstats"
|
||||||
|
|
||||||
|
if [[ $isDocker == false ]]
|
||||||
|
then
|
||||||
|
info "installing docker"
|
||||||
|
curl -sSL https://get.docker.com/ | sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
dir=$HOME/.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):")
|
||||||
|
|
||||||
|
|
||||||
|
mkdir -p $dir
|
||||||
|
cat > $dir/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
|
||||||
|
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
function install()
|
function install()
|
||||||
@ -442,11 +509,11 @@ function run_installer()
|
|||||||
|
|
||||||
function finish()
|
function finish()
|
||||||
{
|
{
|
||||||
# echo
|
echo
|
||||||
# successHeading "Installation successful!"
|
successHeading "Installation successful!"
|
||||||
# head "Next steps"
|
# head "Next steps"
|
||||||
# info "Run ${cyan}\`\`${reset} to get started.${reset}"
|
# info "Run ${cyan}\`\`${reset} to get started.${reset}"
|
||||||
# echo
|
echo
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,11 +527,26 @@ function run_installer()
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
# Prompt user to continue or abort
|
# Prompt user to continue or abort
|
||||||
wait_for_user "${b}OK,${reset} let's go!"
|
if wait_for_user "${b}OK,${reset} let's go!"
|
||||||
|
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 dependencies and eth
|
||||||
install
|
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
|
||||||
|
|
||||||
# Check installation
|
# Check installation
|
||||||
verify_installation
|
verify_installation
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user