summaryrefslogtreecommitdiff
path: root/include/option.sh
diff options
context:
space:
mode:
Diffstat (limited to 'include/option.sh')
-rwxr-xr-xinclude/option.sh17
1 files changed, 12 insertions, 5 deletions
diff --git a/include/option.sh b/include/option.sh
index 2284fb0b..8fc80aaa 100755
--- a/include/option.sh
+++ b/include/option.sh
@@ -22,6 +22,14 @@ eval "$(setvars "" CONFIG_BOARD_DELL_E6400 CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN \
CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE _dest board boarddir \
CONFIG_HAVE_REFCODE_BLOB CONFIG_REFCODE_BLOB_FILE)"
+threads=
+set | grep LBMK_THREADS 1>/dev/null 2>/dev/null || threads=$(nproc) || :
+[ -z "$threads" ] && threads=$LBMK_THREADS
+[ -z "$threads" ] && threads=1 # LBMK_THREADS not set, and nproc failed
+
+expr "X$threads" : "X-\{0,1\}[0123456789][0123456789]*$" \
+ 1>/dev/null 2>/dev/null || threads=1 # user specified a non-integer
+
items()
{
rval=1
@@ -43,10 +51,9 @@ scan_config()
{
awkstr=" /\{.*${1}.*}{/ {flag=1;next} /\}/{flag=0} flag { print }"
confdir="${2}"
- _fail="${3}"
revfile="$(mktemp -t sources.XXXXXXXXXX)"
cat "${confdir}/"* > "${revfile}" || \
- "${_fail}" "scan_config ${confdir}: Cannot concatenate files"
+ $err "scan_config ${confdir}: Cannot concatenate files"
while read -r line ; do
set ${line} 1>/dev/null 2>/dev/null || :
if [ "${1%:}" = "depend" ]; then
@@ -57,7 +64,7 @@ scan_config()
done << EOF
$(eval "awk '${awkstr}' \"${revfile}\"")
EOF
- rm -f "$revfile" || "$_fail" "scan_config: Cannot remove tmpfile"
+ rm -f "$revfile" || $err "scan_config: Cannot remove tmpfile"
}
check_defconfig()
@@ -81,6 +88,6 @@ handle_coreboot_utils()
remkdir()
{
- rm -Rf "${1}" || err "remkdir: !rm -Rf \"${1}\""
- mkdir -p "${1}" || err "remkdir: !mkdir -p \"${1}\""
+ rm -Rf "${1}" || $err "remkdir: !rm -Rf \"${1}\""
+ mkdir -p "${1}" || $err "remkdir: !mkdir -p \"${1}\""
}