Fixed clean_builddir()

This commit is contained in:
Manuel Canales Esparcia 2006-10-07 19:11:58 +00:00
parent 640e48be9f
commit 5468631e31

View file

@ -420,24 +420,21 @@ clean_builddir() { #
#----------------------------# #----------------------------#
# Test if the clean must be done. # Test if the clean must be done.
if [ "${CLEAN}" = "y" ]; then if [ "${CLEAN}" = "y" ]; 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 # Test to make sure that the build directory was populated by jhalfs
if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
echo "Looks like $BUILDDIR was not populated by a previous jhalfs-X run." echo "Looks like $BUILDDIR was not populated by a previous jhalfs run."
exit 1 exit 1
else else
# Clean the build directory # Clean the build directory
echo -ne "Cleaning $BUILDDIR...\n" echo -n "Cleaning $BUILDDIR ..."
rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var} sudo rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var}
echo -ne "Cleaning $JHALFSDIR...\n" echo "done"
rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,*commands,*logs,Makefile,*.xsl,makefile-functions,pkg_tarball_list,*.config,*.sh} echo -n "Cleaning $JHALFSDIR ..."
echo -ne "Cleaning remainig extracted sources in $BUILDDIR/sources...\n" sudo rm -rf $JHALFSDIR
rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d` echo "done"
echo -ne "done\n" echo -n "Cleaning remainig extracted sources in $BUILDDIR/sources ..."
sudo rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
echo "done"
fi fi
fi fi
} }