Fix env config checks, allow building in local dir

This commit is contained in:
JeremyStar™ 2024-03-10 22:47:01 +01:00
parent 3c4df47ad1
commit 69249c8a74

View file

@ -69,7 +69,7 @@ fi
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source "/etc/os-release" source "/etc/os-release"
if [ "${NAME}" != "Arch Linux" ] || [ "${PRETTY_NAME}" != "Arch Linux" ] || [ "${ID}" != "arch" ]; then 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" errorh "Not running on Arch Linux"
errore "This kernel can only compile 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" 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 ## Ask for building in tmpfs
function ask_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 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 case "${BUILDTOOL_TMPFS}" in
"y"|"Y"|"") "y"|"Y"|"")
@ -291,6 +296,12 @@ function ask_debug() {
} }
## Ask for clone directory conflict resolution (includes check) ## Ask for clone directory conflict resolution (includes check)
function ask_clonedir_conflictresolution() { 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 if [ ! -d "${BUILDTOOL_CLONEDIR}" ] && [ ! -L "${BUILDTOOL_CLONEDIR}" ]; then
return return
elif [ -a "${BUILDTOOL_CLONEDIR}" ] && [ ! -d "${BUILDTOOL_CLONEDIR}" ] && [ ! -L "${BUILDTOOL_CLONEDIR}" ]; then elif [ -a "${BUILDTOOL_CLONEDIR}" ] && [ ! -d "${BUILDTOOL_CLONEDIR}" ] && [ ! -L "${BUILDTOOL_CLONEDIR}" ]; then