summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild_a_system.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/build_a_system.sh b/build_a_system.sh
index d38b8ce..c2a6e36 100755
--- a/build_a_system.sh
+++ b/build_a_system.sh
@@ -16,13 +16,17 @@ ybd_dir="$(pwd)/ybd"
# x86 VPS, but we'd like to see some parallelism on the ARM builders,
# which have 8 CPUs total, so we'd need to have 4 to see any parallelism.
cpus_per_instance=4
+ncpus="$(nproc)"
# Determine the number of instances to have such that each has at least
# the specified number of CPUs but not more than double it.
# STYLE NOTE: Substitutions are intentionally not quoted here, since in
# some shells arithmetic expansion doesn't follow the traditional POSIX
# word splitting, so quotes aren't removed.
-instances="$(( $(nproc) / $cpus_per_instance == 0 ? 1 : $(nproc) / $cpus_per_instance ))"
+instances="$(expr "$ncpus" / "$cpus_per_instance")"
+if [ "$instances" -eq 0 ]; then
+ instances=1
+fi
sudo sed -i "/^instances: /c\\instances: $instances" "$ybd_dir"/ybd.conf
# will this build things - No.