Merged r2204 and r2205 from trunk.

This commit is contained in:
Manuel Canales Esparcia 2005-11-24 19:19:16 +00:00
parent b6ca3232fb
commit 1db9dcac6d

51
jhalfs
View file

@ -27,6 +27,11 @@ Options:
jhalfs produces will be in the directory
DIR/jhalfs. Default is \"/mnt/lfs\".
--rebuild clean the build directory before to perfom
any other task. The directory is cleaned
only if it was populated by a previous
jhalfs run.
-P, --get-packages download the packages and patches. This
assumes that the server declared in the
jhalfs.conf file has the proper packages
@ -113,6 +118,33 @@ HEADER="# This file is automatically generated by jhalfs
###################################
#----------------------------#
clean_builddir() {
#----------------------------#
# Test if the clean must be done.
if [ "$CLEAN" = "1" ] ; then
# Test to make sure we're running the clean as root
if [ "$UID" != "0" ] ; then
echo "You must be logged in as root to clean the build directory."
exit 1
fi
# Test to make sure that the build directory was populated by jhalfs
if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
echo "Look like $BUILDDIR was not populated by a previous jhalfs run."
exit 1
else
# Clean the build directory
echo -ne "Cleaning $BUILDDIR...\n"
rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,usr,var}
echo -ne "Cleaning $JHALFSDIR...\n"
rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,commands,logs,Makefile,dump-lfs-scripts.xsl,functions,packages,patches}
echo -ne "Cleaning remainig extracted sources in $BUILDDIR/sources...\n"
rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
echo -ne "done\n"
fi
fi
}
#----------------------------#
get_book() {
#----------------------------#
@ -962,6 +994,8 @@ while test $# -gt 0 ; do
MKFILE=$JHALFSDIR/Makefile
;;
--rebuild ) CLEAN=1 ;;
--download-client | -D )
test $# = 1 && eval "$exit_missing_arg"
shift
@ -1050,14 +1084,23 @@ 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 prevents setting "-d /"
# by mistake.
# Prevents setting "-d /" by mistake.
if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] ; then
if [ $BUILDDIR = / ] ; then
echo -ne "\nThe root directory can't be used to build LFS.\n\n"
exit 1
fi
# If $BUILDDIR have subdirectories like tools/ or bin/, stop the run
# and notify the user about that.
if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then
eval "$no_empty_builddir"
fi
# If requested, clean the build directory
clean_builddir
# Find the download client to use, if not already specified.
if [ -z $DL ] ; then