Changeset 8a43b5b


Ignore:
Timestamp:
05/13/2006 11:26:19 AM (18 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:
7d9a82d
Parents:
046d5c3
Message:

Simplified download code.
Now the MD5 sum values are set in the books.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/common-functions

    r046d5c3 r8a43b5b  
    660660  cd $BUILDDIR/sources
    661661  [[ -f MD5SUMS ]] && rm MD5SUMS
    662   [[ -f MD5SUMS-$VERSION ]] && rm MD5SUMS-$VERSION
    663662  [[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP
    664663  [[ -f urls.lst ]] && rm urls.lst
    665 
    666     # Download a fresh MD5SUMS file
    667   wget $SERVER/pub/lfs/conglomeration/MD5SUMS
    668664
    669665    # Generate URLs file
     
    690686    BOOKMD5=`echo $line | cut -d" " -f3` # MD5 book value
    691687
    692     if [[ x"$BOOKMD5" != "x" ]]; then
    693       HAVEMD5=1
    694       MD5="$BOOKMD5  $FILE"
    695     else
    696       # Find the md5 sum for this package in the server MD5SUMS file.
    697       set +e
    698       HAVEMD5=1  # Always assume we have a MD5SUM
    699       MD5=`grep "  $FILE" MD5SUMS`
    700       if [ $? -ne 0 ]; then
    701         set -e
    702         gs_wrt_message "$FILE not found in MD5SUMS"
    703           # IMPORTANT:: There is no MD5SUM for this file.
    704         HAVEMD5=0
    705       fi
    706     fi
     688      # Validation pair
     689    MD5="$BOOKMD5  $FILE"
     690    HAVEMD5=1
    707691
    708692    set -e
     
    718702      echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE}${OFF}"
    719703      fromARCHIVE=0
    720       # If the file does not exist in /sources download a fresh one
     704      # If the file does not exist yet in /sources download a fresh one
    721705      if [ ! -f $FILE ] ; then
    722706        if ! wget $URL1 && ! wget $URL2 ; then
     
    727711    fi
    728712
    729       # Is there a MD5SUM to validate the file against.
    730     if [[ "$HAVEMD5" = "1" ]] ; then
    731         # IF the md5sum does not match the existing files
    732       if ! echo "$MD5" | md5sum -c - >/dev/null ; then
    733         [[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}"
    734         [[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}"
    735           # Remove the old file and download a new one
    736         rm -fv $FILE
    737           # Force generation of MD5SUM and storage in SRC_ARCHIVE
    738         fromARCHIVE=0;
    739           # Try and retrieve the file. Servers in reverse order.
    740         if ! wget $URL2 && ! wget $URL1 ; then
    741           gs_wrt_message "$FILE not found on the servers.. SKIPPING"
    742           continue
    743         fi
     713      # IF the md5sum does not match the existing files
     714    if ! echo "$MD5" | md5sum -c - >/dev/null ; then
     715      [[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}"
     716      [[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}"
     717        # Remove the old file and download a new one
     718      rm -fv $FILE
     719        # Force storage in SRC_ARCHIVE
     720      fromARCHIVE=0;
     721        # Try to retrieve again the file. Servers in reverse order.
     722      if ! wget $URL2 && ! wget $URL1 ; then
     723        gs_wrt_message "$FILE not found on the servers.. SKIPPING"
     724        continue
    744725      fi
    745726    fi
    746727
    747728      # Validate the MD5SUM one last time
    748     if [[ "$HAVEMD5" = "1" ]] && ! echo "$MD5" | md5sum -c - >/dev/null ; then
     729    if ! echo "$MD5" | md5sum -c - >/dev/null ; then
    749730      gs_wrt_message "$FILE does not match MD5SUMS value"
    750731      # Force generation of MD5SUM
     
    755736    if [[ "$HAVEMD5" = "0" ]] ; then
    756737      echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE"
    757       echo "NEW MD5SUM $(md5sum $FILE)" >> MISSING_FILES.DMP
     738      echo "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP
    758739    fi
    759740
    760741      # Good or bad we write the original md5sum to a file
    761     echo "$MD5" >> MD5SUMS-$VERSION
     742    echo "$MD5" >> MD5SUMS
    762743
    763744     # Copy the freshly downloaded file
Note: See TracChangeset for help on using the changeset viewer.