From 1500a0a136fcf89af50be0364d9f70f77dc595e0 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Thu, 1 Oct 2015 19:43:58 +0000 Subject: Replace ncpus logic with something easier to debug and hopefully more reliable --- build_a_system.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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. -- cgit v1.2.1