Parity install sceipt cleanups.
This commit is contained in:
parent
83fe91c88f
commit
b1110272a4
@ -1,6 +1,6 @@
|
|||||||
#!/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
|
PARITY_DEB_URL=https://github.com/ethcore/parity/releases/download/beta-0.9/parity_linux_0.9.0-0_amd64.deb
|
||||||
|
|
||||||
|
|
||||||
function run_installer()
|
function run_installer()
|
||||||
@ -47,6 +47,7 @@ function run_installer()
|
|||||||
dim=`tput dim`
|
dim=`tput dim`
|
||||||
reverse=`tput rev`
|
reverse=`tput rev`
|
||||||
reset=`tput sgr0`
|
reset=`tput sgr0`
|
||||||
|
n=$'\n'
|
||||||
|
|
||||||
|
|
||||||
function head() {
|
function head() {
|
||||||
@ -94,13 +95,19 @@ function run_installer()
|
|||||||
####### Setup methods
|
####### Setup methods
|
||||||
|
|
||||||
function wait_for_user() {
|
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 :
|
while :
|
||||||
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] ) return 0; break ;;
|
[yY] ) echo true; break ;;
|
||||||
'' ) echo; break ;;
|
'' ) echo true; break ;;
|
||||||
[nN] ) return 1 ;;
|
[nN] ) echo false; break ;;
|
||||||
* ) echo "Unrecognized option provided. Please provide either 'Y' or 'N'";
|
* ) echo "Unrecognized option provided. Please provide either 'Y' or 'N'";
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -119,6 +126,14 @@ function run_installer()
|
|||||||
echo "\$ $@"; "$@"
|
echo "\$ $@"; "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sudo() {
|
||||||
|
if $isSudo; then
|
||||||
|
`which sudo` "$@"
|
||||||
|
else
|
||||||
|
"$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function detectOS() {
|
function detectOS() {
|
||||||
if [[ "$OSTYPE" == "linux-gnu" ]]
|
if [[ "$OSTYPE" == "linux-gnu" ]]
|
||||||
then
|
then
|
||||||
@ -130,7 +145,7 @@ function run_installer()
|
|||||||
get_osx_dependencies
|
get_osx_dependencies
|
||||||
else
|
else
|
||||||
OS_TYPE="win"
|
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.${n}For instructions on installing parity on other platforms please visit ${u}${blue}http://ethcore.io/${reset}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@ -184,8 +199,8 @@ function run_installer()
|
|||||||
fi
|
fi
|
||||||
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+="${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()
|
function get_osx_dependencies()
|
||||||
@ -206,11 +221,14 @@ function run_installer()
|
|||||||
isUbuntu=true
|
isUbuntu=true
|
||||||
else
|
else
|
||||||
check "Ubuntu, but version not supported"
|
check "Ubuntu, but version not supported"
|
||||||
isUbuntu=false
|
|
||||||
|
errorMessages+="${red}==>${reset} ${b}Ubuntu version not supported:${reset} This script requires Ubuntu version 14.04, 15.04 or 15.10.${n}"
|
||||||
|
errorMessages+=" Please either upgrade your Ubuntu installation or using the get-deps.ethcore.io script instead, which can help you build Parity.${n}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
check "Ubuntu not found"
|
check "Ubuntu not found"
|
||||||
isUbuntu=false
|
errorMessages+="${red}==>${reset} ${b}Linux distribution not supported:${reset} This script requires Ubuntu version 14.04, 15.04 or 15.10.${n}"
|
||||||
|
errorMessages+=" Please either use this on an Ubuntu installation or instead use the get-deps.ethcore.io script, which can help you build Parity.${n}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,15 +236,12 @@ function run_installer()
|
|||||||
{
|
{
|
||||||
linux_version
|
linux_version
|
||||||
|
|
||||||
find_multirust
|
|
||||||
find_rocksdb
|
find_rocksdb
|
||||||
|
|
||||||
find_curl
|
find_curl
|
||||||
find_git
|
|
||||||
find_make
|
|
||||||
find_gcc
|
|
||||||
|
|
||||||
find_apt
|
find_apt
|
||||||
|
find_sudo
|
||||||
}
|
}
|
||||||
|
|
||||||
function find_brew()
|
function find_brew()
|
||||||
@ -242,10 +257,10 @@ function run_installer()
|
|||||||
uncheck "Homebrew is missing"
|
uncheck "Homebrew is missing"
|
||||||
isBrew=false
|
isBrew=false
|
||||||
|
|
||||||
INSTALL_FILES+="${blue}${dim}==> Homebrew:${reset}\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/bin/brew${n}"
|
||||||
INSTALL_FILES+=" ${blue}${dim}➜${reset} $HOMEBREW_PREFIX/Library\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/share/man/man1/brew.1${n}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
depCount=$((depCount+1))
|
depCount=$((depCount+1))
|
||||||
@ -267,8 +282,54 @@ function run_installer()
|
|||||||
uncheck "Ruby is missing 🔥"
|
uncheck "Ruby is missing 🔥"
|
||||||
isRuby=false
|
isRuby=false
|
||||||
canContinue=false
|
canContinue=false
|
||||||
errorMessages+="${red}==>${reset} ${b}Couldn't find Ruby:${reset} Brew requires Ruby which could not be found.\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"
|
errorMessages+=" Please install Ruby using these instructions ${u}${blue}https://www.ruby-lang.org/en/documentation/installation/${reset}.${n}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function find_sudo()
|
||||||
|
{
|
||||||
|
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"
|
||||||
|
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
|
||||||
|
INSTALL_FILES+="${blue}${dim}==>${reset}\tsudo${n}"
|
||||||
|
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}"
|
||||||
|
fi
|
||||||
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +343,7 @@ function run_installer()
|
|||||||
else
|
else
|
||||||
uncheck "librocksdb is missing"
|
uncheck "librocksdb is missing"
|
||||||
isRocksDB=false
|
isRocksDB=false
|
||||||
INSTALL_FILES+="${blue}${dim}==>${reset}\tlibrocksdb\n"
|
INSTALL_FILES+="${blue}${dim}==>${reset}\tlibrocksdb${n}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,8 +363,8 @@ function run_installer()
|
|||||||
isApt=false
|
isApt=false
|
||||||
|
|
||||||
canContinue=false
|
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+="${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+=" Please switch to a distribution such as Debian or Ubuntu or manually install the missing packages.${n}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,21 +395,28 @@ function run_installer()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function ubuntu_rocksdb_bin_installer()
|
|
||||||
{
|
|
||||||
sudo apt-get update -qq
|
|
||||||
sudo apt-get install -qq -y software-properties-common
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
function linux_deps_installer()
|
function linux_deps_installer()
|
||||||
{
|
{
|
||||||
|
if [[ $isSudo == false ]]; then
|
||||||
|
info "Installing sudo..."
|
||||||
|
apt-get install -q -y sudo
|
||||||
|
echo
|
||||||
|
fi
|
||||||
if [[ $isRocksDB == false ]]; then
|
if [[ $isRocksDB == false ]]; then
|
||||||
info "Installing rocksdb binaries..."
|
info "Installing rocksdb..."
|
||||||
ubuntu_rocksdb_bin_installer
|
|
||||||
|
sudo apt-get update -qq
|
||||||
|
sudo apt-get install -qq -y software-properties-common
|
||||||
|
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
|
||||||
|
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
if [[ $isCurl == false ]]; then
|
||||||
|
info "Installing curl..."
|
||||||
|
sudo apt-get install -q -y curl
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -361,7 +429,7 @@ function run_installer()
|
|||||||
info "Installing parity"
|
info "Installing parity"
|
||||||
file=/tmp/parity.deb
|
file=/tmp/parity.deb
|
||||||
|
|
||||||
wget $PARITY_DEB_URL -qO $file
|
curl -L $PARITY_DEB_URL > $file
|
||||||
sudo dpkg -i $file
|
sudo dpkg -i $file
|
||||||
rm $file
|
rm $file
|
||||||
}
|
}
|
||||||
@ -510,10 +578,8 @@ EOL
|
|||||||
|
|
||||||
#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?"
|
if [[ $(ask_user "${b}Last chance!${reset} Sure you want to install this software?") == true ]]; then
|
||||||
then
|
|
||||||
install
|
install
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
@ -521,19 +587,12 @@ EOL
|
|||||||
finish
|
finish
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $OS_TYPE == "linux" && $DISTRIB_ID == "Ubuntu" ]]; 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
|
||||||
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
|
install_netstats
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Display goodbye message
|
# Display goodbye message
|
||||||
finish
|
finish
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user