From 9b78aedb69f129e080c136c282e2265449860cd6 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Mon, 20 Aug 2018 19:39:49 +0000 Subject: [PATCH] mergemaster: better defaults for SOURCEDIR If we can't find a Makefile.inc1 in the specified / default SOURCEDIR, and there's a Makefile.inc1 in the current directory, offer the user the choice of using . for SOURCEDIR. Differential Revsion: https://reviews.freebsd.org/D16709 --- usr.sbin/mergemaster/mergemaster.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/usr.sbin/mergemaster/mergemaster.sh b/usr.sbin/mergemaster/mergemaster.sh index 31904e8efa0..b6106f60bff 100755 --- a/usr.sbin/mergemaster/mergemaster.sh +++ b/usr.sbin/mergemaster/mergemaster.sh @@ -483,6 +483,27 @@ if [ ! -f ${SOURCEDIR}/Makefile.inc1 -a \ sleep 3 SOURCEDIR=${SOURCEDIR}/.. fi +if [ ! -f ${SOURCEDIR}/Makefile.inc1 ]; then + echo "*** ${SOURCEDIR} was not found." + if [ -f ./Makefile.inc1 ]; then + echo " Found Makefile.inc1 in the current directory." + echo -n " Would you like to set SOURCEDIR to $(pwd)? [no and exit] " + read SRCDOT + case "${SRCDOT}" in + [yY]*) + echo " *** Setting SOURCEDIR to $(pwd)" + SOURCEDIR=$(pwd) + ;; + *) + echo " **** No suitable ${SOURCEDIR} found, exiting" + exit 1 + ;; + esac + else + echo " **** No suitable ${SOURCEDIR} found, exiting" + exit 1 + fi +fi SOURCEDIR=$(realpath "$SOURCEDIR") # Setup make to use system files from SOURCEDIR