Make build menu branch aware
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
REPO_URL="${REPO_URL:-https://github.com/pacificao/agrarian.git}"
|
REPO_URL="${REPO_URL:-https://github.com/pacificao/agrarian.git}"
|
||||||
BRANCH="${BRANCH:-2.0}"
|
|
||||||
WORKDIR="${WORKDIR:-$HOME/agrarian}"
|
WORKDIR="${WORKDIR:-$HOME/agrarian}"
|
||||||
JOBS="${JOBS:-1}"
|
JOBS="${JOBS:-1}"
|
||||||
HOST_WIN64="${HOST_WIN64:-x86_64-w64-mingw32}"
|
HOST_WIN64="${HOST_WIN64:-x86_64-w64-mingw32}"
|
||||||
@@ -10,6 +9,18 @@ HOST_WIN64="${HOST_WIN64:-x86_64-w64-mingw32}"
|
|||||||
MENU_CHOICE=""
|
MENU_CHOICE=""
|
||||||
ROOT=""
|
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
|
if [[ "${EUID:-$(id -u)}" -eq 0 && "${ALLOW_ROOT_BUILD_MENU:-0}" != "1" ]]; then
|
||||||
cat >&2 <<EOF
|
cat >&2 <<EOF
|
||||||
Do not run this script with sudo.
|
Do not run this script with sudo.
|
||||||
|
|||||||
+5
-1
@@ -38,7 +38,7 @@ Defaults
|
|||||||
The script can be configured with environment variables:
|
The script can be configured with environment variables:
|
||||||
|
|
||||||
REPO_URL=https://github.com/pacificao/agrarian.git
|
REPO_URL=https://github.com/pacificao/agrarian.git
|
||||||
BRANCH=2.0
|
BRANCH=<current checkout branch, or main when run standalone>
|
||||||
WORKDIR=$HOME/agrarian
|
WORKDIR=$HOME/agrarian
|
||||||
JOBS=1
|
JOBS=1
|
||||||
|
|
||||||
@@ -46,6 +46,10 @@ Example:
|
|||||||
|
|
||||||
JOBS=8 WORKDIR=$HOME/src/agrarian ./contrib/agrarian-build-menu.sh
|
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
|
Linux Daemon Autostart
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user