From 4618749fab9d1cca78080740b8c37299c1c935c5 Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Thu, 17 Nov 2005 19:16:55 +0000 Subject: [PATCH] Be sure that $BUILDDIR is clean and usable. --- jhalfs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/jhalfs b/jhalfs index 37ce1ae..2173eb2 100755 --- a/jhalfs +++ b/jhalfs @@ -81,6 +81,18 @@ Options: help="\ Try '$0 --help' for more information." +no_empty_builddir="\ +echo \"\" >&2 +echo \" W A R N I N G\" >&2 +echo \"\" >&2 +echo \"Look like the \$BUILDDIR directory contains subdirectories\" >&2 +echo \"from a previous LFS build.\" >&2 +echo \"\" >&2 +echo \"Please, format the partition mounted on \$BUILDDIR or set\" >&2 +echo \"a diferent build directory before to run jhalfs.\" >&2 +echo \"\" >&2 +exit 1" + exit_missing_arg="\ echo \"Option '\$1' requires an argument\" >&2 echo \"\$help\" >&2 @@ -90,7 +102,6 @@ no_dl_client="\ echo \"Could not find a way to download the LFS sources.\" >&2 echo \"Attempting to continue.\" >&2" - HEADER="# This file is automatically generated by jhalfs # DO NOT EDIT THIS FILE MANUALLY # @@ -1009,6 +1020,14 @@ while test $# -gt 0 ; do shift done +# If $BUILDDIR have subdirectories like tools/ or bin/, stop the run +# and notify the user about that. This also prevent to set "-d /" +# by mistake. + +if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] ; then + eval "$no_empty_builddir" +fi + # Find the download client to use, if not already specified. if [ -z $DL ] ; then