get-deps no longer installs rust/multirust/rocksdb if it doesn't have to.

Builds rocksdb only if necessary.
This commit is contained in:
Gav Wood 2016-02-04 18:43:05 +01:00
parent d7365f8a30
commit de6cc18660

View File

@ -347,8 +347,31 @@ function run_installer()
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() function get_linux_dependencies()
{ {
linux_version
find_multirust
find_rocksdb
find_curl find_curl
find_git find_git
find_make find_make
@ -357,6 +380,47 @@ function run_installer()
find_apt 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"
echo "$($APT_PATH -v)"
isRocksDB=true
else
uncheck "librocksdb is missing"
isRocksDB=false
INSTALL_FILES+="${blue}${dim}==> librocksdb:${reset}\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}==> 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"
fi
}
function find_apt() function find_apt()
{ {
depCount=$((depCount+1)) depCount=$((depCount+1))
@ -449,8 +513,19 @@ function run_installer()
fi fi
} }
function ubuntu1404_rocksdb_installer()
{
sudo add-apt-repository -y ppa:giskou/librocksdb
sudo apt-get -f -y install
sudo apt-get update -qq
sudo apt-get install -y librocksdb
}
function linux_rocksdb_installer() function linux_rocksdb_installer()
{ {
if [[ $isUbuntu1404 ]]; then
ubuntu1404_rocksdb_installer
else
oldpwd=`pwd` oldpwd=`pwd`
cd /tmp cd /tmp
exe git clone --branch v4.1 --depth=1 https://github.com/facebook/rocksdb.git exe git clone --branch v4.1 --depth=1 https://github.com/facebook/rocksdb.git
@ -461,13 +536,14 @@ function run_installer()
cd /tmp cd /tmp
rm -rf /tmp/rocksdb rm -rf /tmp/rocksdb
cd $oldpwd cd $oldpwd
fi
} }
function linux_installer() function linux_installer()
{ {
if [[ $isGCC == false || $isGit == false || $isMake == false || $isCurl == false ]]; then if [[ $isGCC == false || $isGit == false || $isMake == false || $isCurl == false ]]; then
info "Installing build dependencies..." info "Installing build dependencies..."
sudo apt-get update sudo apt-get update -qq
if [[ $isGit == false ]]; then if [[ $isGit == false ]]; then
sudo apt-get install -q -y git sudo apt-get install -q -y git
fi fi
@ -483,15 +559,24 @@ function run_installer()
echo echo
fi fi
if [[ $isRocksDB == false ]]; then
info "Installing rocksdb..." info "Installing rocksdb..."
linux_rocksdb_installer linux_rocksdb_installer
echo echo
fi
if [[ $isMultirust == false ]]; then
info "Installing multirust..." info "Installing multirust..."
curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sudo sh -s -- --yes 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 update nightly
sudo multirust default nightly sudo multirust default nightly
echo echo
fi
} }
function install() function install()
@ -511,12 +596,19 @@ function run_installer()
function verify_installation() function verify_installation()
{ {
info "Verifying installation" info "Verifying installation"
# find_eth
# if [[ $isEth == false ]] if [[ $OS_TYPE == "linux" ]]; then
# then find_curl
# abortInstall find_git
# fi 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
} }
function abortInstall() function abortInstall()
@ -530,11 +622,9 @@ function run_installer()
function finish() function finish()
{ {
# echo echo
# successHeading "Installation successful!" successHeading "Installation successful!"
# head "Next steps" echo
# info "Run ${cyan}\`\`${reset} to get started.${reset}"
# echo
exit 0 exit 0
} }