mirror of
https://github.com/cculianu/Fulcrum.git
synced 2026-08-13 12:33:27 +02:00
Message from submitter: Build failed on my Debian Buster machine, because WORKER_COUNT was assigned a string of $CPU_COUNT+1 --- Note from Calin: I was unable to reproduce his problem, but since his new fix and old fix produce equivalent results for me, and he claims his way fixes something for him, merging.
19 lines
480 B
Bash
19 lines
480 B
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
if [ -z "$CPU_COUNT" ] ; then
|
|
# CPU_COUNT is not set, try to detect the core count
|
|
case $(uname) in
|
|
Linux)
|
|
export CPU_COUNT=$(lscpu | grep "^CPU(s):" | awk '{print $2}')
|
|
;;
|
|
Darwin)
|
|
export CPU_COUNT=$(sysctl -n hw.ncpu)
|
|
;;
|
|
esac
|
|
fi
|
|
# If CPU_COUNT is still unset, default to 4
|
|
export CPU_COUNT="${CPU_COUNT:-4}"
|
|
# Use one more worker than core count
|
|
export WORKER_COUNT=$(($CPU_COUNT+1))
|