Fix conflict resolution

This commit is contained in:
JeremyStar™ 2024-08-31 21:46:10 +02:00
parent a5c3dc96e9
commit 1e70122d93
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -329,39 +329,30 @@ function ask_clonedir_conflictresolution() {
if [ -n "${BUILDTOOL_LOCALDIR}" ]; then
warnh "Skipped conflict resolution (\$BUILDTOOL_LOCALDIR is set)"
export "BUILDTOOL_CLONEDIR_CONFLICT=r"
if [ -a "${BUILDTOOL_CLONEDIR}/src" ]; then
diagh "src/ directory present, appending \"--noextract\""
export "BUILDTOOL_MAKEPKG_REUSE= --noextract"
fi
if [ -a "${BUILDTOOL_CLONEDIR}/pkg" ]; then
diagh "pkg/ directory present, appending \"--force\""
export "BUILDTOOL_MAKEPKG_REUSE=${BUILDTOOL_MAKEPKG_REUSE} --force"
fi
return
fi
[[ ! -d "${BUILDTOOL_CLONEDIR}" ]] && [[ ! -L "${BUILDTOOL_CLONEDIR}" ]] && return
[[ -a "${BUILDTOOL_CLONEDIR}" ]] && [[ ! -d "${BUILDTOOL_CLONEDIR}" ]] && [[ ! -L "${BUILDTOOL_CLONEDIR}" ]] && warnh "Something that isn't a directory or symlink exists at location \"${BUILDTOOL_CLONEDIR}\""
read -rp "$(infoh "Warning: \"${BUILDTOOL_CLONEDIR}\" already exists. What should be done to resolve the conflict [A(bort)/r(ecompile)/f(resh)]? ")" BUILDTOOL_CLONEDIR_CONFLICT
[[ -z "${BUILDTOOL_CLONEDIR_CONFLICT}" ]] && read -rp "$(infoh "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"|"")
errorh "Conflict resolution failed"
exit 1
;;
"r"|"R")
if [ -a "${BUILDTOOL_CLONEDIR}/src" ]; then
if [ -a "${BUILDTOOL_CLONEDIR}/src" ] || [ -a "/tmp/makepkg/linux-jstm-optimized/src" ]; then
diagh "src/ directory present, appending \"--noextract\""
export "BUILDTOOL_MAKEPKG_REUSE= --noextract"
elif [ -a "${BUILDTOOL_CLONEDIR}/pkg" ]; then
elif [ -a "${BUILDTOOL_CLONEDIR}/pkg" ] || [ -a "/tmp/makepkg/linux-jstm-optimized/pkg" ]; then
diagh "pkg/ directory present, appending \"--force\""
export "BUILDTOOL_MAKEPKG_REUSE=${BUILDTOOL_MAKEPKG_REUSE} --force"
fi
;;
"f"|"F")
infoh "Removing existing \$BUILDTOOL_CLONEDIR directory"
rm -rf "${BUILDTOOL_CLONEDIR}"
rm -rf "${BUILDTOOL_CLONEDIR}" "/tmp/makepkg/linux-jstm-optimized"
;;
*)
errorh "Invalid answer. Please answer with Y, N or I"
errorh "Invalid answer. Please answer with A, R or F"
ask_debug
esac
}