X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=functions-update;h=e47d3832f8b9705a57d7d61cb0b1ec93af35fae6;hb=afdcc2624aec2f5aaaf00aa211455ba54eaf0703;hp=cb7a7e81e915637c604d88d6da5f4701c35ea4c9;hpb=aa229d2908422fce286bbd65710e31b086c8a2a2;p=hvlinux.git diff --git a/functions-update b/functions-update index cb7a7e8..e47d383 100644 --- a/functions-update +++ b/functions-update @@ -18,7 +18,7 @@ HV_PATCHES_URL="${HV_BASE_URL}/patches" LFS_PACKAGES_URL="ftp://ftp.osuosl.org/pub/lfs/lfs-packages/conglomeration" HV_PACKAGES_URL="${HV_BASE_URL}/packages" -SOURCEFORGE_URL="http://internap.dl.sourceforge.net/sourceforge" +SOURCEFORGE_URL="http://cdnetworks-us-1.dl.sourceforge.net" GNOME_URL="http://ftp.gnome.org/pub/gnome/sources" GNU_URL="http://ftp.gnu.org/pub/gnu" TETEX_URL="http://www.tug.org/ftp/tex-archive/systems/unix/teTeX" @@ -45,6 +45,10 @@ static_fetch_patches_list() # slash is absolutely necessary for this to work. update_packages_init() { + # Execute a return statement instead of exit, to be able to continue with + # downloading other packages + export RCMD_NO_EXIT=1 + # First create log directory if it does not exists. if [ ! -d ${LFS_LOG_DIR} ]; then install -m755 -d ${LFS_LOG_DIR} || exit 1 @@ -182,6 +186,7 @@ detect_file_not_found() # HTTP: will return error code 404. # FTP: will say "File not found" if grep "404" ${WGET_LOG_FILE} 1> /dev/null 2>&1; then + echo NOTFOUND return 0 elif grep "No such file" ${WGET_LOG_FILE} 1> /dev/null 2>&1; then return 0 @@ -193,23 +198,27 @@ detect_file_not_found() # Get package if it is not in the repository # Arg. #1: Package name and version # Arg. #2: URL +# Arg. #3: Optional extension static_getpkg() { - PACK=${1} - URL=${2} + local PACK=${1} + local URL=${2} + local MY_ARCH_EXT=${3} # Checking for correct number of arguments - if [ $# -ne 2 ]; then + if [ $# -ne 2 -a $# -ne 3 ]; then echo "${FUNCNAME}(), wrong number of arguments: ${*}" return 1 fi if [ -z "${ARCH_EXT}" ]; then # List of default archive extensions to try - ARCH_EXT="tar.bz2 tar.gz tgz .tar.Z" + MY_ARCH_EXT="tar.bz2 tar.gz tgz tar.Z" fi - for arch_ext in ${ARCH_EXT}; do + echo " MY_ARCH_EXT=${MY_ARCH_EXT}" + + for arch_ext in ${MY_ARCH_EXT}; do ${WGETCMD} ${URL}/${PACK}.${arch_ext} # Failure: if it was a connection timeout, don't try for other file extensions. @@ -224,7 +233,7 @@ static_getpkg() fi # If we arrive here, it means we were able to download the file. - if [ "x${arch_ext}" != "xtar.bz2" ]; then + 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 return $? @@ -248,8 +257,34 @@ fpkg() return 1 fi - if [ ! -f ${LFS_PKG_DIR}/${PACK}.tar.bz2 ]; then - rcmd "Fetching ${PACK}" static_getpkg ${PACK} ${URL} + # Default extension + local FINAL_EXT=tar.bz2 + + local FETCH_STRING="Fetching ${PACK}" + + if [ -n "${ARCH_EXT}" ]; then + FINAL_EXT=${ARCH_EXT} + FETCH_STRING="${FETCH_STRING}.${ARCH_EXT}" + fi + + # Default destination directory + local MY_FETCH_DIR=${LFS_PKG_DIR} + + if [ -n "${FETCH_DIR}" ]; then + local MY_FETCH_DIR=${FETCH_DIR} + local MOVE_FILE=1 + fi + + DEST_FILE=${MY_FETCH_DIR}/${PACK}.${FINAL_EXT} + + ##########echo "DEST_FILE=${DEST_FILE}" + if [ ! -f ${DEST_FILE} ]; then + rcmd "${FETCH_STRING}" static_getpkg ${PACK} ${URL} ${ARCH_EXT} + + # Move to final directory if alternate directory specified + if [ -f ${LFS_PKG_DIR}/${PACK}.${FINAL_EXT} -a -n "${MOVE_FILE}" ]; then + mv ${LFS_PKG_DIR}/${PACK}.${FINAL_EXT} ${DEST_FILE} + fi fi # Check if a patch is available. @@ -274,11 +309,18 @@ fpkg_mis() reurn 1 fi - if [ ! -f ${LFS_PKG_DIR}/${TARGET}.tar.bz2 ]; then + if [ -z "${ARCH_EXT}" ]; then + # Default extension + FINAL_EXT=tar.bz2 + else + FINAL_EXT=${ARCH_EXT} + fi + + if [ ! -f ${LFS_PKG_DIR}/${TARGET}.${FINAL_EXT} ]; then fpkg ${SOURCE} ${URL} - if [ -f ${LFS_PKG_DIR}/${SOURCE}.tar.bz2 ]; then - mv ${LFS_PKG_DIR}/${SOURCE}.tar.bz2 ${LFS_PKG_DIR}/${TARGET}.tar.bz2 + if [ -f ${LFS_PKG_DIR}/${SOURCE}.${FINAL_EXT} ]; then + mv ${LFS_PKG_DIR}/${SOURCE}.${FINAL_EXT} ${LFS_PKG_DIR}/${TARGET}.${FINAL_EXT} fi fi