diff options
Diffstat (limited to 'packaging/installer/functions.sh')
-rw-r--r-- | packaging/installer/functions.sh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh index fd10fcfa..6264c113 100644 --- a/packaging/installer/functions.sh +++ b/packaging/installer/functions.sh @@ -224,17 +224,22 @@ safe_pidof() { # ----------------------------------------------------------------------------- find_processors() { - # Most UNIX systems have `nproc` as part of their userland (including macOS, Linux and BSD) + # Most UNIX systems have `nproc` as part of their userland (including Linux and BSD) if command -v nproc > /dev/null; then nproc && return fi + # macOS has no nproc but it may have gnproc installed from Homebrew or from Macports. + if command -v gnproc > /dev/null; then + gnproc && return + fi + local cpus if [ -f "/proc/cpuinfo" ]; then # linux cpus=$(grep -c ^processor /proc/cpuinfo) else - # freebsd + # freebsd cpus=$(sysctl hw.ncpu 2> /dev/null | grep ^hw.ncpu | cut -d ' ' -f 2) fi if [ -z "${cpus}" ] || [ $((cpus)) -lt 1 ]; then |