Changeset 65d83a6


Ignore:
Timestamp:
05/03/2006 07:35:01 PM (18 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
experimental
Children:
17c7894
Parents:
3e7af38
Message:

Synchrnized experimental branch with trunk.

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • LFS/master.sh

    r3e7af38 r65d83a6  
    162162    # Remove Bzip2 binaries before make install
    163163    sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2
    164     # Fix how Module-Init-Tools do the install target
    165     sed -e 's@make install@make INSTALL=install install@' -i chapter06$N/*-module-init-tools
    166     # Delete *old Readline libraries just after make install
    167     sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i chapter06$N/*-readline
    168164    # Let some Udev pre-installation commands to fail
    169165    sed -e 's@/lib/udev/devices/fd@& || true@' \
  • README

    r3e7af38 r65d83a6  
    7676    Q. "It doesn't work"
    7777    A. Yes it does..
    78 
     78   
     79    Q. "How do I specify the build location"
     80    A. The original LFS document worked against the well know location /mnt/lfs.
     81       This script automates the build of all of the LFS series of books and uses
     82       a generic location $BUILDDIR with a default value a /mnt/build_dir.
     83       You may change this value to suit your needs.
     84 
     85       The layout below $BUILDDIR is as follows.
     86       $BUILDDIR/
     87            jhalfs      (makefile,cmd scripts,logs..etc)
     88            sources     (where packages reside
     89            temptools   (temporary bootstrap system
     90            cross-tools (CLFS only)
     91                ...
     92            FHS dir structure
     93                ...
     94   
    7995    Q. "What is the function of the SRC_ARCHIVE variable
    8096    A. When then symlinked master.sh runs it creates a local copy of the
     
    84100       If the files are not found in SRC_ARCHIVE _and_ you have write priv to
    85101       the directory any downloaded files will be mirrored there.
    86 
     102       
     103    Q. "How do I set the SRC_ARCHIVE location"
     104    A. The best way to set the value of SRC_ARCHIVE is
     105       export SRC_ARCHIVE=/wherever/you/store/downloaded/packages
     106                       OR
     107       you can change the setting in .common/config.
     108   
    87109    Q. "Why have 2 copies of the files."
    88110    A. The package files must be visible during the chroot phase and this is a
  • common/common-functions

    r3e7af38 r65d83a6  
    2525declare -r  nl_=$'\n'
    2626
    27 declare -r   DD_BORDER="${BOLD}${WHITE}==============================================================================${OFF}"
    28 declare -r   SD_BORDER="${BOLD}${WHITE}------------------------------------------------------------------------------${OFF}"
    29 declare -r STAR_BORDER="${BOLD}${WHITE}******************************************************************************${OFF}"
     27declare -r   DD_BORDER="${BOLD}==============================================================================${OFF}"
     28declare -r   SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
     29declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
    3030
    3131# bold yellow > <  pair
     
    5454        use DIR directory for building ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF}; all files jhalfs-X produces
    5555        will be in the directory DIR/jhalfs.
     56        The current setting for BUILDDIR is "$BUILDDIR"
    5657
    5758${BOLD}  -G, --get-packages${OFF}
     
    245246
    246247
    247 #=============================#
    248 wrt_unpack3() {               #
    249 #=============================#
     248#----------------------------------#
     249wrt_unpack3() {                    #
     250#----------------------------------#
    250251  local FILE=$1
    251252(
     
    301302
    302303
    303 #=============================#
    304 wrt_run_as_root2() {          #
    305 #=============================#
     304#----------------------------------#
     305wrt_run_as_root2() {               #
     306#----------------------------------#
    306307  local this_script=$1
    307308  local file=$2
     
    400401
    401402#----------------------------------#
    402 wrt_report() {         #
     403wrt_report() {                     #
    403404#----------------------------------#
    404405(
     
    418419
    419420#----------------------------#
    420 run_make() {
     421run_make() {                 #
    421422#----------------------------#
    422423  # Test if make must be run.
     
    438439
    439440#----------------------------#
    440 clean_builddir() {
     441clean_builddir() {           #
    441442#----------------------------#
    442443  # Test if the clean must be done.
     
    465466
    466467#----------------------------#
    467 get_book() {
     468get_book() {                 #
    468469#----------------------------#
    469470  cd $JHALFSDIR
     
    488489    if [ -d ${PROGNAME}-$LFSVRS ] ; then
    489490      cd ${PROGNAME}-$LFSVRS
    490       if LC_ALL=C svn up | grep -q At && test -d $JHALFSDIR/commands && \
    491       test -f $JHALFSDIR/packages && test -f $JHALFSDIR/patches ; then
     491      if LC_ALL=C svn up | grep -q At && test -d $JHALFSDIR/${PROGNAME}-commands && \
     492      test -f $JHALFSDIR/packages ; then
    492493        echo -ne "done\n"
    493494        # Set the canonical book version
     
    628629}
    629630
    630 
    631631#----------------------------#
    632632get_sources() {              # Download file, write name to MISSING_FILES.DMP if an error
    633633#----------------------------#
    634634  local saveIFS=$IFS
    635   local IFS line URL1 URL2 FILE MD5
    636 
    637   # Test if the packages must be downloaded
    638   if [ "$GETPKG" = "1" ] ; then
    639 
    640     [[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources
    641     cd $BUILDDIR/sources
    642     [[ -f MD5SUMS ]] && rm MD5SUMS
    643     [[ -f MD5SUMS-$VERSION ]] && rm MD5SUMS-$VERSION
    644     [[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP
    645     [[ -f urls.lst ]] && rm urls.lst
     635  local IFS line URL1 URL2 FILE MD5 HAVEMD5 fromARCHIVE
     636
     637    # Test if the packages must be downloaded
     638  [ ! "$GETPKG" = "1" ] && return
     639
     640  gs_wrt_message(){
     641    echo "${RED}$1${OFF}"
     642    echo "$1" >> MISSING_FILES.DMP
     643  }
     644    # Housekeeping
     645  [[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources
     646  cd $BUILDDIR/sources
     647  [[ -f MD5SUMS ]] && rm MD5SUMS
     648  [[ -f MD5SUMS-$VERSION ]] && rm MD5SUMS-$VERSION
     649  [[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP
     650  [[ -f urls.lst ]] && rm urls.lst
    646651
    647652    # Download a fresh MD5SUMS file
    648     wget $SERVER/pub/lfs/conglomeration/MD5SUMS
     653  wget $SERVER/pub/lfs/conglomeration/MD5SUMS
    649654
    650655    # Generate URLs file
    651     create_urls
    652 
    653     IFS=$'\x0A'  # Modify the 'internal field separator' to break on 'LF' only
    654     for line in `cat urls.lst`; do
    655       IFS=$saveIFS  # Restore the system defaults
     656  create_urls
     657
     658  IFS=$'\x0A'  # Modify the 'internal field separator' to break on 'LF' only
     659  for line in `cat urls.lst`; do
     660    IFS=$saveIFS  # Restore the system defaults
    656661
    657662      # Skip some packages if they aren't needed
    658       case $line in
     663    case $line in
    659664        */tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* )
    660665            [[ "$TEST" = "0" ]] && continue
     
    663668            [[ "$VIMLANG" = "0" ]] && continue
    664669          ;;
    665       esac
    666 
    667       URL1=`echo $line | cut -d" " -f1` # Upstream URL
    668       URL2=`echo $line | cut -d" " -f2` # Fallback URL
    669       FILE=`basename $URL2` # File name
    670 
    671       # If the file exists in the archive copy it to the $BUILDDIR/sources dir
    672       # MD5SUM is assumed to be correct from previous download
    673       if [ ! -z ${SRC_ARCHIVE} ] &&
    674          [ -d ${SRC_ARCHIVE} ] &&
    675          [ -f ${SRC_ARCHIVE}/$FILE ]; then
    676         cp ${SRC_ARCHIVE}/$FILE .
    677         echo "$FILE: -- copied from $SRC_ARCHIVE"
     670    esac
     671
     672      # Locations
     673    URL1=`echo $line | cut -d" " -f2` # Preferred URL
     674    URL2=`echo $line | cut -d" " -f1` # Fallback Upstream URL
     675    FILE=`basename $URL2` # File name
     676
     677      # Find the md5 sum for this package.
     678    set +e
     679    HAVEMD5=1  # Always assume we have a MD5SUM
     680    MD5=`grep "  $FILE" MD5SUMS`
     681    if [ $? -ne 0 ]; then
     682      set -e
     683      gs_wrt_message "$FILE not found in MD5SUMS"
     684        # IMPORTANT:: There is no MD5SUM for this file.
     685      HAVEMD5=0
     686    fi
     687
     688    set -e
     689      # If the file exists in the archive copy it to the
     690      # $BUILDDIR/sources dir. MD5SUM will be validated later.
     691    if [ ! -z ${SRC_ARCHIVE} ] &&
     692       [   -d ${SRC_ARCHIVE} ] &&
     693       [   -f ${SRC_ARCHIVE}/$FILE ]; then
     694      cp ${SRC_ARCHIVE}/$FILE .
     695      echo "$FILE: -- copied from $SRC_ARCHIVE"
     696      fromARCHIVE=1
     697    else
     698      echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE}${OFF}"
     699      fromARCHIVE=0
     700      # If the file does not exist in /sources download a fresh one
     701      if [ ! -f $FILE ] ; then
     702        if ! wget $URL1 && ! wget $URL2 ; then
     703          gs_wrt_message "$FILE not found in the SRC_ARCHIVE or on any server..SKIPPING"
     704          continue
     705        fi
    678706      fi
    679 
    680       # Find the md5 sum for this package.
    681       set +e
    682       MD5=`grep "  $FILE" MD5SUMS`
    683       if [ $? -ne 0 ]; then
    684         set -e
    685         echo "${RED}$FILE not found in MD5SUMS${OFF}"
    686         echo "$FILE not found in MD5SUMS" >> MISSING_FILES.DMP
     707    fi
     708
     709      # Is there a MD5SUM to validate the file against.
     710    if [[ "$HAVEMD5" = "1" ]] ; then
     711        # IF the md5sum does not match the existing files
     712      if ! echo "$MD5" | md5sum -c - >/dev/null ; then
     713        [[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}"
     714        [[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}"
     715          # Remove the old file and download a new one
     716        rm -fv $FILE
     717          # Force generation of MD5SUM and storage in SRC_ARCHIVE
     718        fromARCHIVE=0; HAVEMD5=0
     719          # Try and retrieve the file
     720        if ! wget -N $URL1 && ! wget -N $URL2 ; then
     721          gs_wrt_message "$FILE not found on the servers.. SKIPPING"
     722          continue
     723        fi
    687724      fi
    688       set -e
    689 
    690       if [ ! -f $FILE ] ; then
    691         wget $URL1 || wget $URL2
    692       elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then
    693         wget -N $URL1 || wget -N $URL2
    694       fi
    695 
    696       if ! echo "$MD5" | md5sum -c - ; then
    697         echo "${RED}$FILE not match MD5SUMS value${OFF}"
    698         echo "$FILE not match MD5SUMS value" >> MISSING_FILES.DMP
    699       fi
    700       echo `grep "$MD5" MD5SUMS` >> MD5SUMS-$VERSION
    701 
    702       # Copy the freshly downloaded file
    703       # to the source archive.
    704       if [ ! -z ${SRC_ARCHIVE} ] &&
    705          [ -d ${SRC_ARCHIVE} ] &&
    706          [ -w ${SRC_ARCHIVE} ] &&
    707          [ ! -f ${SRC_ARCHIVE}/$FILE ] ; then
    708         echo "Store file:<$FILE> in package archive"
    709         cp -v $FILE ${SRC_ARCHIVE}
    710       fi
    711 
    712     done
    713 
    714     if [[ -s MISSING_FILES.DMP ]]; then
    715       echo  -e "\n\n${tab_}${RED} One or more files were not retrieved or have a bad MD5SUMS chechsum.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n\n"
    716     fi
    717 
     725    fi
     726
     727      # Validate the MD5SUM one last time
     728    if [[ "$HAVEMD5" = "1" ]] && ! echo "$MD5" | md5sum -c - >/dev/null ; then
     729      gs_wrt_message "$FILE does not match MD5SUMS value"
     730    fi
     731
     732      # Generate a fresh MD5SUM for this file
     733    if [[ "$HAVEMD5" = "0" ]] ; then
     734      echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE"
     735      echo "NEW MD5SUM $(md5sum $FILE)" >> MISSING_FILES.DMP
     736    fi
     737
     738      # Good or bad we write the original md5sum to a file
     739    echo "$MD5" >> MD5SUMS-$VERSION
     740
     741     # Copy the freshly downloaded file
     742     # to the source archive.
     743   if [ ! -z ${SRC_ARCHIVE}  ] &&
     744      [   -d ${SRC_ARCHIVE}  ] &&
     745      [   -w ${SRC_ARCHIVE}  ] &&
     746      [ "$fromARCHIVE" = "0" ] ; then
     747        echo "Storing file:<$FILE> in the package archive"
     748        cp -f $FILE ${SRC_ARCHIVE}
     749   fi
     750
     751  done
     752
     753  if [[ -s MISSING_FILES.DMP ]]; then
     754    echo  -e "\n\n${tab_}${RED} One or more files were not retrieved or have a bad MD5SUMS chechsum.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n"
     755      # Do not allow the automatic exection of the Makefile.
     756    echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}"
     757    RUNMAKE=0
    718758  fi
    719759}
  • common/config

    r3e7af38 r65d83a6  
    5353
    5454#--- set default timezone.
    55 TIMEZONE=America/Toronto
     55TIMEZONE=GMT
    5656
    5757#--- install the optional vim-lang package  0(no)/1(yes)
  • common/create-sbu_du-report.sh

    r3e7af38 r65d83a6  
    1515  echo -e "\nLooks like $LOGSDIR isn't a jhalfs logs directory.\n" && exit
    1616
    17 # If this script is run manually, the book version may be unknow
     17# If this script is run manually, the book version may be unknown
    1818[[ -z "$VERSION" ]] && VERSION=unknown
    1919
     
    7575
    7676#Start disk usage calculation
    77   # Disk usage before unpack the package
     77  # Disk usage before unpacking the package
    7878  DU1=`grep "^KB: " $log | head -n1 | cut -f1 | sed -e 's/KB: //'`
    7979  DU1MB=`echo "scale=2; $DU1 / 1024" | bc`
    80   # Disk usage before delete sources and build dirs
     80  # Disk usage before deleting the source and build dirs
    8181  DU2=`grep "^KB: " $log | tail -n1 | cut -f1 | sed -e 's/KB: //'`
    8282  DU2MB=`echo "scale=2; $DU2 / 1024" | bc`
     
    109109
    110110  # Dump disk usage values
    111   echo -e "\nDisk usage before unpack the package:\t\t\t$DU1 KB or $DU1MB MB" >> "$REPORT"
    112   echo -e "Disk usage before delete sources and build dirs:\t$DU2 KB or $DU2MB MB" >> "$REPORT"
     111  echo -e "\nDisk usage before unpacking the package:\t\t\t$DU1 KB or $DU1MB MB" >> "$REPORT"
     112  echo -e "Disk usage before deleting the source and build dirs:\t$DU2 KB or $DU2MB MB" >> "$REPORT"
    113113  echo -e "Required space to build the package:\t\t\t$REQUIRED1 KB or $REQUIRED2 MB\n" >> "$REPORT"
    114114
  • common/func_compare.sh

    r3e7af38 r65d83a6  
    109109    cat << EOF
    110110        @pushd logs 1> /dev/null && \\
     111        rm $ITERATION && \\
    111112        mkdir $ITERATION && \\
    112113        mv ${LOGS} $ITERATION && \\
  • common/func_validate_configs.sh

    r3e7af38 r65d83a6  
    256256  done
    257257  set -e
    258   echo "$tab_***${BOLD}${GREEN} ${PARAM_GROUP%%_*T} config parameters look good${OFF} ***"
     258  echo "${nl_}***${BOLD}${GREEN} ${PARAM_GROUP%%_*T} config parameters look good${OFF} ***${nl_}"
    259259}
  • common/urls.xsl

    r3e7af38 r65d83a6  
    2323                  or not(ancestor::varlistentry[@condition])) and
    2424                  (contains(@url, '.tar.') or contains(@url, '.tgz')
    25                   or contains(@url, '.patch') or contains(@url, '.rules')) and
     25                  or contains(@url, '.patch')) and
    2626                  not(ancestor-or-self::*/@condition = 'pdf')">
    2727      <!-- Extract the package name -->
  • master.sh

    r3e7af38 r65d83a6  
    7272[[ $VERBOSITY > 0 ]] && echo "OK"
    7373#
    74 [[ $VERBOSITY > 0 ]] && echo "---------------${nl_}"
     74[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
    7575
    7676
     
    9393[[ $? > 0 ]] && echo " function module did not load.." && exit 2
    9494[[ $VERBOSITY > 0 ]] && echo "OK"
    95 [[ $VERBOSITY > 0 ]] && echo "---------------${nl_}"
     95[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
    9696
    9797
     
    433433tarVer=`tar --version`
    434434check_version "1.15.0" "${tarVer##* }"      "TAR"
    435 echo "---------------${nl_}"
     435echo "${SD_BORDER}${nl_}"
    436436
    437437validate_config
    438 echo "---------------${nl_}"
     438echo "${SD_BORDER}${nl_}"
    439439
    440440echo -n "Are you happy with these settings? yes/no (no): "
     
    444444  exit 1
    445445fi
    446 echo "${nl_}---------------${nl_}"
     446echo "${nl_}${SD_BORDER}${nl_}"
    447447
    448448# Prevents setting "-d /" by mistake.
     
    496496
    497497get_book
    498 echo "---------------${nl_}"
     498echo "${SD_BORDER}${nl_}"
    499499
    500500build_Makefile
    501 echo "---------------${nl_}"
     501echo "${SD_BORDER}${nl_}"
    502502
    503503run_make
Note: See TracChangeset for help on using the changeset viewer.