]> granicus.if.org Git - sudo/commitdiff
Use /proc/cpuinfo on Linux instead of running lscpu
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 3 Aug 2016 12:31:17 +0000 (06:31 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 3 Aug 2016 12:31:17 +0000 (06:31 -0600)
mkpkg

diff --git a/mkpkg b/mkpkg
index ab10cd768618c1caef126f028453af4e517e7215..c398b08838e5c48068018824dc3d26c4b141ca7f 100755 (executable)
--- a/mkpkg
+++ b/mkpkg
@@ -94,15 +94,17 @@ osrelease=`echo "$osversion" | sed -e 's/^[^0-9]*//' -e 's/-.*$//'`
 
 # If using GNU make, set number of jobs
 if make --version 2>&1 | grep GNU >/dev/null; then
-    NJOBS=1
+    NJOBS=0
     case "`uname`" in
        Darwin)
            # Mac OS X
            NJOBS=`sysctl -n hw.ncpu`
            ;;
        Linux)
-           if [ -x /usr/bin/lscpu ]; then
-               NJOBS=`/usr/bin/lscpu -p=cpu | grep -v '^#' | wc -l`
+           if [ -r /proc/cpuinfo ]; then
+               for c in `sed -n 's/^cpu cores[  ]*: *//p' /proc/cpuinfo`; do
+                   NJOBS=$(( $NJOBS + $c ))
+               done
            fi
            ;;
        SunOS)