From 69249c8a740224f92fb738a18f06a077986b7539 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sun, 10 Mar 2024 22:47:01 +0100 Subject: [PATCH] Fix env config checks, allow building in local dir --- buildtool.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/buildtool.sh b/buildtool.sh index c7468f7..83d0949 100755 --- a/buildtool.sh +++ b/buildtool.sh @@ -69,7 +69,7 @@ fi # shellcheck disable=SC1091 source "/etc/os-release" if [ "${NAME}" != "Arch Linux" ] || [ "${PRETTY_NAME}" != "Arch Linux" ] || [ "${ID}" != "arch" ]; then - if [ "${BUILDTOOL_COMPILE_NONARCH}" != "true" ]; then + if [ -z "${BUILDTOOL_COMPILE_NONARCH}" ]; then errorh "Not running on Arch Linux" errore "This kernel can only compile on Arch Linux" errore "If you are sure that you want to compile this kernel on other distributions" @@ -123,6 +123,11 @@ function ask_cpupower() { } ## Ask for building in tmpfs function ask_tmpfs() { + if [ -n "${BUILDTOOL_LOCALDIR}" ]; then + warnh "Skipped ask_tmpfs, building in local directory instead (\$BUILDTOOL_LOCALDIR is set)" + export "BUILDTOOL_CLONEDIR=$(pwd)" + return + fi read -rp "$(infoh "Do you want to build in a tmpfs (improves build performance, protects your disk from wearing out faster, ~32 GiB memory required) [Y/n]? ")" BUILDTOOL_TMPFS case "${BUILDTOOL_TMPFS}" in "y"|"Y"|"") @@ -291,6 +296,12 @@ function ask_debug() { } ## Ask for clone directory conflict resolution (includes check) function ask_clonedir_conflictresolution() { + if [ -n "${BUILDTOOL_LOCALDIR}" ]; then + warnh "Skipped conflict resolution (\$BUILDTOOL_LOCALDIR is set)" + export "BUILDTOOL_CLONEDIR_CONFLICT=r" + export "BUILDTOOL_MAKEPKG_REUSE= --noextract --force" + return + fi if [ ! -d "${BUILDTOOL_CLONEDIR}" ] && [ ! -L "${BUILDTOOL_CLONEDIR}" ]; then return elif [ -a "${BUILDTOOL_CLONEDIR}" ] && [ ! -d "${BUILDTOOL_CLONEDIR}" ] && [ ! -L "${BUILDTOOL_CLONEDIR}" ]; then