Changeset dc53def
- Timestamp:
- 05/07/2022 09:25:43 AM (2 years ago)
- Branches:
- ablfs-more, trunk
- Children:
- 6df52e8
- Parents:
- 88e5cbc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
common/libs/func_download_pkgs
r88e5cbc rdc53def 6 6 7 7 # Test if the packages must be downloaded 8 [ ! "$GETPKG" = "y" ] &&return8 [ "$GETPKG" = y ] || return 9 9 10 local saveIFS=$IFS 11 local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE WGETPARAM 10 local URL FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE WGETPARAM MAYBEMORE 12 11 13 12 WGETPARAM="" … … 32 31 >MISSING_FILES.DMP 33 32 34 IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only 35 for line in `cat urls.lst`; do 36 IFS=$saveIFS # Restore the system defaults 37 38 # Locations 39 URL1=`echo $line | cut -d" " -f2` # Preferred URL 40 URL2=`echo $line | cut -d" " -f1` # Fallback Upstream URL 41 FILE=`basename $URL1` # File name 42 BOOKMD5=`echo $line | cut -d" " -f3` # MD5 book value 33 # Normally, urls.lst contains lines with two fields: 34 # <package url> <book md5>, but 35 # if a custom patch has an md5, there is a third field 36 # on the line, due to the way add_CustomToolsURLS works. 37 cat urls.lst | while read URL BOOKMD5 MAYBEMORE; do 38 FILE=$(basename "$URL") # File name 43 39 44 40 # Validation pair … … 47 43 48 44 set -e 49 # If the file exists in the archive copy it to the45 # If the file exists in the archive, copy it to the 50 46 # $BUILDDIR/sources dir. MD5SUM will be validated later. 51 if [ ! -z ${SRC_ARCHIVE}] &&52 [ -d ${SRC_ARCHIVE}] &&53 [ -f ${SRC_ARCHIVE}/$FILE]; then54 cp ${SRC_ARCHIVE}/$FILE.47 if [ -n "${SRC_ARCHIVE}" ] && 48 [ -d "${SRC_ARCHIVE}" ] && 49 [ -f "${SRC_ARCHIVE}/$FILE" ]; then 50 cp "${SRC_ARCHIVE}/$FILE" . 55 51 echo "$FILE: -- copied from $SRC_ARCHIVE" 56 52 fromARCHIVE=1 57 53 else 58 54 fromARCHIVE=0 59 # If the file does not exist yet in /sources download a fresh one60 if [ ! -f $FILE] ; then61 if [ [ ! ("$SRC_ARCHIVE" = "") ]] ; then62 echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE} or${BUILDDIR}/sources${OFF}"55 # If the file does not exist yet in /sources, download a fresh one 56 if [ ! -f "$FILE" ] ; then 57 if [ -n "$SRC_ARCHIVE" ] ; then 58 echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE} nor in ${BUILDDIR}/sources${OFF}" 63 59 else 64 60 echo "${BOLD}${YELLOW}$FILE: not found in ${BUILDDIR}/sources${OFF}" 65 61 fi 66 if ! wget $URL1 $WGETPARAM && ! wget $URL2 $WGETPARAM; then67 gs_wrt_message "$FILE not found in the SRC_ARCHIVE oron any server..SKIPPING"62 if ! wget "$URL" "$WGETPARAM"; then 63 gs_wrt_message "$FILE not found on any server..SKIPPING" 68 64 continue 69 65 fi … … 73 69 fi 74 70 75 # Deal with udev and bootscripts m5sum issue 76 [[ $BOOKMD5 = "BOOTSCRIPTS-MD5SUM" ]] && continue 77 [[ $BOOKMD5 = "UDEV-MD5SUM" ]] && continue 78 [[ $BOOKMD5 = "LFS-NETSCRIPTS-MD5SUM" ]] && continue 79 [[ $BOOKMD5 = "CUSTOM-PATCH-MD5SUM" ]] && continue 71 # Deal with bootscripts md5sum issue, 72 # or skip if it is a custom patch without md5 73 [ $BOOKMD5 = "BOOTSCRIPTS-MD5SUM" ] && continue 74 [ $BOOKMD5 = "CUSTOM-PATCH-MD5SUM" ] && continue 80 75 81 # IF the md5sum does not match the existing files76 # IF the md5sum does not match 82 77 if ! echo "$MD5" | md5sum -c - >/dev/null ; then 83 [ [ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not matchSRC_ARCHIVE copy${OFF}"84 [ [ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}"78 [ "$fromARCHIVE" = 1 ] && echo "${BOLD}${YELLOW}MD5SUM did not match $SRC_ARCHIVE copy${OFF}" 79 [ "$fromARCHIVE" = 0 ] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}" 85 80 # Remove the old file and download a new one 86 rm -fv $FILE81 rm -fv "$FILE" 87 82 # Force storage in SRC_ARCHIVE 88 83 fromARCHIVE=0; 89 # Try to retrieve again the file. Servers in reverse order.90 if ! wget $URL2 $WGETPARAM && ! wget $URL1 $WGETPARAM; then91 gs_wrt_message "$FILE not found on the server s.. SKIPPING"84 # Try to retrieve again the file. 85 if ! wget "$URL" "$WGETPARAM"; then 86 gs_wrt_message "$FILE not found on the server... SKIPPING" 92 87 continue 93 88 fi … … 102 97 103 98 # Generate a fresh MD5SUM for this file 104 if [ [ "$HAVEMD5" = "0" ]] ; then99 if [ "$HAVEMD5" = "0" ] ; then 105 100 echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE" 106 101 echo "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP … … 112 107 # Copy the freshly downloaded file 113 108 # to the source archive. 114 if [ ! -z ${SRC_ARCHIVE}] &&115 [ -d ${SRC_ARCHIVE}] &&116 [ -w ${SRC_ARCHIVE}] &&117 [ ! -f ${SRC_ARCHIVE}/$FILE] &&118 [ "$fromARCHIVE" = "0"] ; then109 if [ -n "${SRC_ARCHIVE}" ] && 110 [ -d "${SRC_ARCHIVE}" ] && 111 [ -w "${SRC_ARCHIVE}" ] && 112 [ ! -f "${SRC_ARCHIVE}/$FILE" ] && 113 [ "$fromARCHIVE" = 0 ] ; then 119 114 echo "Storing file:<$FILE> in the package archive" 120 cp -f $FILE ${SRC_ARCHIVE}115 cp -f "$FILE" "${SRC_ARCHIVE}" 121 116 fi 122 117
Note:
See TracChangeset
for help on using the changeset viewer.