Add clone dir conflict resolution

This commit is contained in:
JeremyStar™ 2024-03-10 21:26:37 +01:00
parent 24c1065ab7
commit 7639862e51

View file

@ -13,12 +13,13 @@ echo ""
# Variables
export "BUILDTOOL_REPOSITORY=https://git.staropensource.de/JeremyStarTM/kernel-optimized.git"
export "BUILDTOOL_PACKAGES=base-devel git rustup"
export "BUILDTOOL_CLONEDIR=jstm-kernel-optimized"
export "BUILDTOOL_BUILDCMDLINE=nice -20 env MAKEFLAGS=-j$(nproc)"
export "BUILDTOOL_CLONEDIR=jstm-kernel-optimized"
# Checks
## Check for Arch Linux
(
# shellcheck disable=SC1091
source "/etc/os-release"
if [ "${NAME}" != "Arch Linux" ] || [ "${PRETTY_NAME}" != "Arch Linux" ] || [ "${ID}" != "arch" ]; then
if [ "${BUILDTOOL_COMPILE_NONARCH}" != "true" ]; then
@ -241,6 +242,29 @@ function ask_debug() {
ask_debug
esac
}
## Ask for clone directory conflict resolution (includes check)
function ask_clonedir_conflictresolution() {
if [ ! -d "${BUILDTOOL_CLONEDIR}" ]; then
return
elif [ -a "${BUILDTOOL_CLONEDIR}" ] && [ ! -d "${BUILDTOOL_CLONEDIR}" ]; then
echo ":: Warning: Something that isn't a directory exists at location \"${BUILDTOOL_CLONEDIR}\""
fi
read -rp ":: Warning: \"${BUILDTOOL_CLONEDIR}\" already exists. What should be done to resolve the conflict [A(bort)/r(ecompile)/f(resh)]? " BUILDTOOL_CLONEDIR_CONFLICT
case "${BUILDTOOL_CLONEDIR_CONFLICT}" in
"a"|"A"|"")
echo ":: Error: Conflict resolution failed."
exit 1
;;
"r"|"R") ;;
"f"|"F")
echo ":: Removing existing \$BUILDTOOL_CLONEDIR directory"
#rm -rf "${BUILDTOOL_CLONEDIR}"
;;
*)
echo "Invalid answer. Please answer with Y, N or I."
ask_debug
esac
}
ask_mold
ask_cpupower
ask_tmpfs
@ -250,6 +274,7 @@ ask_cpfinalconfig
ask_modprobeddb
ask_subarchitecture
ask_debug
ask_clonedir_conflictresolution
# Pre-building
## Install dependencies