#!/bin/ash -efu
#
# mki-count-cpu
#
# This file is part of mkimage
# Copyright (C) 2007-2012  Alexey Gladkov <gladkov.alexey@gmail.com>
#
# This file is covered by the GNU General Public License,
# which should be included with mkimage as the file COPYING.
#

ncpu=$(getconf _NPROCESSORS_ONLN 2>/dev/null) ||:

[ "$ncpu" != "0" ] ||
	ncpu=$(grep -c '^processor' /proc/cpuinfo 2>/dev/null) ||:

[ "$ncpu" != "0" ] ||
	ncpu=1

printf '%s\n' "$ncpu"
