Default build menu jobs to CPU count
This commit is contained in:
@@ -3,7 +3,6 @@ set -euo pipefail
|
||||
|
||||
REPO_URL="${REPO_URL:-https://github.com/pacificao/agrarian.git}"
|
||||
WORKDIR="${WORKDIR:-$HOME/agrarian}"
|
||||
JOBS="${JOBS:-1}"
|
||||
HOST_WIN64="${HOST_WIN64:-x86_64-w64-mingw32}"
|
||||
|
||||
MENU_CHOICE=""
|
||||
@@ -21,6 +20,18 @@ if [[ -z "${BRANCH:-}" ]]; then
|
||||
fi
|
||||
BRANCH="${BRANCH:-main}"
|
||||
|
||||
detect_build_jobs() {
|
||||
if command -v nproc >/dev/null 2>&1; then
|
||||
nproc
|
||||
elif command -v getconf >/dev/null 2>&1; then
|
||||
getconf _NPROCESSORS_ONLN
|
||||
else
|
||||
echo 1
|
||||
fi
|
||||
}
|
||||
|
||||
JOBS="${JOBS:-$(detect_build_jobs)}"
|
||||
|
||||
if [[ "${EUID:-$(id -u)}" -eq 0 && "${ALLOW_ROOT_BUILD_MENU:-0}" != "1" ]]; then
|
||||
cat >&2 <<EOF
|
||||
Do not run this script with sudo.
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ The script can be configured with environment variables:
|
||||
REPO_URL=https://github.com/pacificao/agrarian.git
|
||||
BRANCH=<current checkout branch, or main when run standalone>
|
||||
WORKDIR=$HOME/agrarian
|
||||
JOBS=1
|
||||
JOBS=<detected CPU count>
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user