From 018bb4ed5d5184900afda157e4e82f0df64389d0 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Thu, 1 Aug 2019 09:59:17 -0400 Subject: [PATCH] Variable default --- scripts/eosio_build_amazon.sh | 2 +- scripts/eosio_build_centos.sh | 2 +- scripts/eosio_build_darwin.sh | 4 ++-- scripts/eosio_build_fedora.sh | 2 +- scripts/eosio_build_ubuntu.sh | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/eosio_build_amazon.sh b/scripts/eosio_build_amazon.sh index 7a16e4486e9..ab9977d912b 100755 --- a/scripts/eosio_build_amazon.sh +++ b/scripts/eosio_build_amazon.sh @@ -100,7 +100,7 @@ MEM_MEG=$( free -m | sed -n 2p | tr -s ' ' | cut -d\ -f2 ) CPU_SPEED=$( lscpu | grep "MHz" | tr -s ' ' | cut -d\ -f3 | cut -d'.' -f1 ) CPU_CORE=$( nproc ) MEM_GIG=$(( ((MEM_MEG / 1000) / 2) )) -export JOBS=$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG )) +export JOBS=${JOBS:-$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG ))} printf "\\nOS name: %s\\n" "${OS_NAME}" printf "OS Version: %s\\n" "${OS_VER}" diff --git a/scripts/eosio_build_centos.sh b/scripts/eosio_build_centos.sh index 3d0056f0b36..ac87585e763 100755 --- a/scripts/eosio_build_centos.sh +++ b/scripts/eosio_build_centos.sh @@ -7,7 +7,7 @@ MEM_MEG=$( free -m | sed -n 2p | tr -s ' ' | cut -d\ -f2 ) CPU_SPEED=$( lscpu | grep "MHz" | tr -s ' ' | cut -d\ -f3 | cut -d'.' -f1 ) CPU_CORE=$( nproc ) MEM_GIG=$(( ((MEM_MEG / 1000) / 2) )) -export JOBS=$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG )) +export JOBS=${JOBS:-$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG ))} DISK_INSTALL=$( df -h . | tail -1 | tr -s ' ' | cut -d\ -f1 ) DISK_TOTAL_KB=$( df . | tail -1 | awk '{print $2}' ) diff --git a/scripts/eosio_build_darwin.sh b/scripts/eosio_build_darwin.sh index 11bbbc37d99..d4e0abfb40f 100755 --- a/scripts/eosio_build_darwin.sh +++ b/scripts/eosio_build_darwin.sh @@ -7,7 +7,7 @@ OS_PATCH=$(echo "${OS_VER}" | cut -d'.' -f3) MEM_GIG=$(bc <<< "($(sysctl -in hw.memsize) / 1024000000)") CPU_SPEED=$(bc <<< "scale=2; ($(sysctl -in hw.cpufrequency) / 10^8) / 10") CPU_CORE=$( sysctl -in machdep.cpu.core_count ) -export JOBS=$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG )) +export JOBS=${JOBS:-$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG ))} DISK_INSTALL=$(df -h . | tail -1 | tr -s ' ' | cut -d\ -f1 || cut -d' ' -f1) blksize=$(df . | head -1 | awk '{print $2}' | cut -d- -f1) @@ -174,7 +174,7 @@ if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ && cd $BOOST_ROOT \ && ./bootstrap.sh --prefix=$BOOST_ROOT \ - && ./b2 -q -j$(sysctl -in machdep.cpu.core_count) --with-iostreams --with-date_time --with-filesystem \ + && ./b2 -q -j"${JOBS}" --with-iostreams --with-date_time --with-filesystem \ --with-system --with-program_options --with-chrono --with-test install \ && cd .. \ && rm -f boost_$BOOST_VERSION.tar.bz2 \ diff --git a/scripts/eosio_build_fedora.sh b/scripts/eosio_build_fedora.sh index c27f47658d3..d911438900d 100755 --- a/scripts/eosio_build_fedora.sh +++ b/scripts/eosio_build_fedora.sh @@ -19,7 +19,7 @@ if [ "${MEM_MEG}" -lt 7000 ]; then exit 1; fi MEM_GIG=$(( ((MEM_MEG / 1000) / 2) )) -export JOBS=$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG )) +export JOBS=${JOBS:-$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG ))} DISK_INSTALL=$( df -h . | tail -1 | tr -s ' ' | cut -d\\ -f1 ) DISK_TOTAL_KB=$( df . | tail -1 | awk '{print $2}' ) diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index 65fbfeeec07..407de7cdd73 100755 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -8,7 +8,7 @@ MEM_MEG=$( free -m | sed -n 2p | tr -s ' ' | cut -d\ -f2 || cut -d' ' -f2 ) CPU_SPEED=$( lscpu | grep -m1 "MHz" | tr -s ' ' | cut -d\ -f3 || cut -d' ' -f3 | cut -d'.' -f1 ) CPU_CORE=$( nproc ) MEM_GIG=$(( ((MEM_MEG / 1000) / 2) )) -export JOBS=$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG )) +export JOBS=${JOBS:-$(( MEM_GIG > CPU_CORE ? CPU_CORE : MEM_GIG ))} DISK_INSTALL=$(df -h . | tail -1 | tr -s ' ' | cut -d\ -f1 || cut -d' ' -f1) DISK_TOTAL_KB=$(df . | tail -1 | awk '{print $2}')