From 83ec3d7e004219731f82a0d5f893406f41c22741 Mon Sep 17 00:00:00 2001 From: Jaggzh Date: Sun, 26 Dec 2021 19:20:05 -0800 Subject: [PATCH] Added test for sysctl path --- src/platform/unix/BuildLinuxImage.sh.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/platform/unix/BuildLinuxImage.sh.in b/src/platform/unix/BuildLinuxImage.sh.in index 168e8c7a0..4b5457a0d 100644 --- a/src/platform/unix/BuildLinuxImage.sh.in +++ b/src/platform/unix/BuildLinuxImage.sh.in @@ -1,7 +1,13 @@ #!/bin/bash +# Our sysctl call may be run as normal user, +# but /sbin is not always in normal users' PATH. +if [[ -f /sbin/sysctl && -x /sbin/sysctl ]]; then sysctl_bin=/sbin/sysctl +else sysctl_bin=sysctl # If not found in sbin, hope +fi + export ROOT=`pwd` -export NCORES=`sysctl -n hw.ncpu` +export NCORES=`"$sysctl_bin" -n hw.ncpu` while getopts ":ih" opt; do case ${opt} in