Default build menu jobs to CPU count

This commit is contained in:
root
2026-04-30 19:15:09 +00:00
parent ab515d7773
commit e5677eab7e
2 changed files with 13 additions and 2 deletions
+12 -1
View File
@@ -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
View File
@@ -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: