diff --git a/contrib/agrarian-build-menu.sh b/contrib/agrarian-build-menu.sh index 737fe0e6..8f92fbe9 100755 --- a/contrib/agrarian-build-menu.sh +++ b/contrib/agrarian-build-menu.sh @@ -2,7 +2,6 @@ set -euo pipefail REPO_URL="${REPO_URL:-https://github.com/pacificao/agrarian.git}" -BRANCH="${BRANCH:-2.0}" WORKDIR="${WORKDIR:-$HOME/agrarian}" JOBS="${JOBS:-1}" HOST_WIN64="${HOST_WIN64:-x86_64-w64-mingw32}" @@ -10,6 +9,18 @@ HOST_WIN64="${HOST_WIN64:-x86_64-w64-mingw32}" MENU_CHOICE="" ROOT="" +detect_script_branch() { + local script_dir + script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + + git -C "$script_dir" rev-parse --abbrev-ref HEAD 2>/dev/null || true +} + +if [[ -z "${BRANCH:-}" ]]; then + BRANCH="$(detect_script_branch)" +fi +BRANCH="${BRANCH:-main}" + if [[ "${EUID:-$(id -u)}" -eq 0 && "${ALLOW_ROOT_BUILD_MENU:-0}" != "1" ]]; then cat >&2 < WORKDIR=$HOME/agrarian JOBS=1 @@ -46,6 +46,10 @@ Example: JOBS=8 WORKDIR=$HOME/src/agrarian ./contrib/agrarian-build-menu.sh +To test the 2.0 branch from a standalone downloaded copy of the script: + + BRANCH=2.0 ./agrarian-build-menu.sh + Linux Daemon Autostart ----------------------