Changeset da5860a


Ignore:
Timestamp:
11/23/2005 09:55:01 PM (19 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
1.0, 2.3, 2.3.x, 2.4, ablfs, ablfs-more, legacy, new_features, trunk
Children:
0617288
Parents:
5adc3fd
Message:

Added --rebuild switch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jhalfs

    r5adc3fd rda5860a  
    2727                                jhalfs produces will be in the directory
    2828                                DIR/jhalfs. Default is \"/mnt/lfs\".
     29
     30  --rebuild                     clean the build directory before to perfom
     31                                any other task. The directory is cleaned
     32                                only if it was populated by a previous
     33                                jhalfs run.
    2934
    3035  -P, --get-packages            download the packages and patches. This
     
    113118###################################
    114119
     120
     121#----------------------------#
     122clean_builddir() {
     123#----------------------------#
     124  # Test if the clean must be done.
     125  if [ "$CLEAN" = "1" ] ; then
     126    # Test to make sure we're running the clean as root
     127    if [ "$UID" != "0" ] ; then
     128      echo "You must be logged in as root to clean the build directory."
     129      exit 1
     130    fi
     131    # Test to make sure that the build directory was populated by jhalfs
     132    if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
     133      echo "Look like $BUILDDIR was not populated by a previous jhalfs run."
     134      exit 1
     135    else
     136      # Clean the build directory
     137      echo -ne "Cleaning $BUILDDIR...\n"
     138      rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,usr,var}
     139      echo -ne "Cleaning $JHALFSDIR...\n"
     140      rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,commands,logs,Makefile,dump-lfs-scripts.xsl,functions,packages,patches}
     141      echo -ne "done\n"
     142    fi
     143  fi
     144}
    115145
    116146#----------------------------#
     
    963993      ;;
    964994
     995    --rebuild )   CLEAN=1 ;;
     996
    965997    --download-client | -D )
    966998      test $# = 1 && eval "$exit_missing_arg"
     
    10511083done
    10521084
     1085# Prevents setting "-d /" by mistake.
     1086
     1087if [ $BUILDDIR = / ] ; then
     1088  echo -ne "\nThe root directory can't be used to build LFS.\n\n"
     1089  exit 1
     1090fi
     1091
    10531092# If $BUILDDIR have subdirectories like tools/ or bin/, stop the run
    1054 # and notify the user about that. This also prevents setting "-d /"
    1055 # by mistake.
    1056 
    1057 if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] ; then
     1093# and notify the user about that.
     1094
     1095if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then
    10581096  eval "$no_empty_builddir"
    10591097fi
     1098
     1099# If requested, clean the build directory
     1100clean_builddir
    10601101
    10611102# Find the download client to use, if not already specified.
Note: See TracChangeset for help on using the changeset viewer.