X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=functions-update;h=33d9cf4fd0e440ab7e59fb3a5adcf676ea7c67f4;hb=e31a492ed6daa2caeb62aa9ce355c988a62672df;hp=2f2359f368ba3d6e1a3d90b4f2cbbff0fe432f78;hpb=d7900cf1804af891098cd22b0ff32aee9df51969;p=hvlinux.git diff --git a/functions-update b/functions-update index 2f2359f..33d9cf4 100644 --- a/functions-update +++ b/functions-update @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash LFS_PKG_BASE="$(dirname $(pwd))/packages" LFS_PKG_DIR="${LFS_PKG_BASE}/${LFS_STAGE}" @@ -25,7 +25,7 @@ TETEX_URL="http://www.tug.org/ftp/tex-archive/systems/unix/teTeX" BLFS_XORG_URL="http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg" XORG_URL="http://xorg.freedesktop.org/releases/individual" -WGETCMD="wget --directory-prefix=${LFS_PKG_DIR} --timeout=15 --tries=3 -nc --continue --no-check-certificate -o ${WGET_LOG_FILE}" +WGETCMD="wget --directory-prefix=${LFS_PKG_DIR} --timeout=15 --tries=3 -nc --continue --no-check-certificate --no-verbose --output-file=${WGET_LOG_FILE}" LFS_PATCHES_LIST=${LFS_PKG_DIR}/patches-list-lfs.html BLFS_PATCHES_LIST=${LFS_PKG_DIR}/patches-list-blfs.html @@ -40,6 +40,10 @@ static_fetch_patches_list() PATCHES_LIST_FILENAME=${2} ${WGETCMD} "${PATCHES_URL}/" && + + # Append log to global log file + cat ${WGET_LOG_FILE} >> ${LFS_LOG_FILE} && + mv ${LFS_PKG_DIR}/index.html ${PATCHES_LIST_FILENAME} } @@ -191,6 +195,7 @@ detect_file_not_found() echo "404 NOTFOUND" return 0 elif grep "No such file" ${WGET_LOG_FILE} 1> /dev/null 2>&1; then + echo "No such file" return 0 else return 1 @@ -218,28 +223,39 @@ static_getpkg() MY_ARCH_EXT="tar.bz2 tar.gz tgz tar.Z" fi - echo " MY_ARCH_EXT=${MY_ARCH_EXT}" - for arch_ext in ${MY_ARCH_EXT}; do # Don't take any chance: remove any partially downloaded file. # If we arrive here, it means the final destination file was not found # so we can safely remove any file prior to trying to download it. rm -f ${LFS_PKG_DIR}/${PACK}.${arch_ext} + echo "Tryng to fetch ${PACK}.${arch_ext}" + ${WGETCMD} ${URL}/${PACK}.${arch_ext} + wget_status=$? + + # Append log to global log file + cat ${WGET_LOG_FILE} >> ${LFS_LOG_FILE} - # Failure: if it was a connection timeout, don't try for other file extensions. + # Failure: if it was a connection timeout, don't try for other file + # extensions. if grep "failed: Connection timed out" ${WGET_LOG_FILE} 1> /dev/null 2>&1; then echo "Error, wget reported: Connection timed out" return 1 fi if detect_file_not_found; then - # Try next archive extension if web server reported that file is not found. + # Try next archive extension if web server reported that file is not + # found. continue; fi - # If we arrive here, it means we were able to download the file. + if [ ${wget_status} -ne 0 ]; then + echo "Error fetching package ${PACK}.${arch_ext}" + return 1 + fi + + # If we arrive here, it means we were able to successfully download the file. if [ "x${arch_ext}" = "xtar.gz" -o "x${arch_ext}" = "xtgz" -o "x${arch_ext}" = "xtar.Z" ]; then gztobz2 ${LFS_PKG_DIR}/${PACK}.${arch_ext} fi @@ -256,7 +272,7 @@ static_getpkg() # Options: # -e File extension (default is tar.bz2) # -d Fetch directory (default is LFS_PKG_DIR) -# -f Filename (default is PACKAGE) +# -f Filename on server (default is PACKAGE) # -h Display this help and returns # -s Subdirectory on server fpkg() @@ -361,13 +377,16 @@ fpkg() # Check for available patches with PACKAGE (TARGET) name. static_getpatch ${PACK} - # Check for available patches with SRC_FILENAME name. - static_getpatch ${SRC_FILENAME} + if [ ${SRC_FILENAME} != ${PACK} ]; then + # Check for available patches with SRC_FILENAME name. + static_getpatch ${SRC_FILENAME} - # Rename any patch fetched (in fpkg call) and replace SOURCE by TARGET in - # patch name. - if ls ${LFS_PKG_DIR}/${SRC_FILENAME}-*.patch 1> /dev/null 2>&1; then - rename ${SRC_FILENAME} ${PACK} ${LFS_PKG_DIR}/${SRC_FILENAME}-*.patch + # Rename any patch fetched (in fpkg call) and replace SOURCE by TARGET + # in patch name. + if ls ${LFS_PKG_DIR}/${SRC_FILENAME}-*.patch 1> /dev/null 2>&1; then + echo "CMD=${SRC_FILENAME} ${PACK} ${LFS_PKG_DIR}/${SRC_FILENAME}-*.patch" + rename ${SRC_FILENAME} ${PACK} ${LFS_PKG_DIR}/${SRC_FILENAME}-*.patch + fi fi }