install -v -m755 -d ${LFS_PKG_DIR} 1> ${LFS_LOG_FILE} 2>&1 || exit 1
fi
- # Getting list of all patches from LFS server.
- rcmd "Fetching LFS patches list" static_fetch_patches_list ${LFS_PATCHES_URL} ${LFS_PATCHES_LIST}
+ if [ -n "${USE_LFS_PATCHES}" ]; then
+ # Getting list of all patches from LFS server.
+ rcmd "Fetching LFS patches list" static_fetch_patches_list ${LFS_PATCHES_URL} ${LFS_PATCHES_LIST}
+ fi
- # Getting list of all patches from BLFS server.
- rcmd "Fetching BLFS patches list" static_fetch_patches_list ${BLFS_PATCHES_URL} ${BLFS_PATCHES_LIST}
+ if [ -n "${USE_BLFS_PATCHES}" ]; then
+ # Getting list of all patches from BLFS server.
+ rcmd "Fetching BLFS patches list" static_fetch_patches_list ${BLFS_PATCHES_URL} ${BLFS_PATCHES_LIST}
+ fi
- # Getting list of all patches from CLFS server.
- rcmd "Fetching CLFS patches list" static_fetch_patches_list ${CLFS_PATCHES_URL} ${CLFS_PATCHES_LIST}
+ if [ -n "${USE_CLFS_PATCHES}" ]; then
+ # Getting list of all patches from CLFS server.
+ rcmd "Fetching CLFS patches list" static_fetch_patches_list ${CLFS_PATCHES_URL} ${CLFS_PATCHES_LIST}
+ fi
- # Getting list of all patches from hugovil.com server.
- rcmd "Fetching hugovil.com patches list" static_fetch_patches_list ${HV_PATCHES_URL} ${HV_PATCHES_LIST}
+ if [ -n "${USE_HV_PATCHES}" ]; then
+ # Getting list of all patches from hugovil.com server.
+ rcmd "Fetching hugovil.com patches list" static_fetch_patches_list ${HV_PATCHES_URL} ${HV_PATCHES_LIST}
+ fi
}
# Get patch package if it is not in the repository
# 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
return 1
fi
- ${WGETCMD} ${URL}/${PACK}.tar.bz2 && return 0
-
- # 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
+ if [ -z "${ARCH_EXT}" ]; then
+ # List of default archive extensions to try
+ ARCH_EXT="tar.bz2 tar.gz tgz .tar.Z"
fi
- if detect_file_not_found; then
- # If file was not found, maybe a .tar.gz file exist...
- ${WGETCMD} ${URL}/${PACK}.tar.gz
- if [ ${?} -eq 0 ]; then
- gztobz2 ${LFS_PKG_DIR}/${PACK}.tar.gz || return 1
- return 0
- else
- if detect_file_not_found; then
- # If file was not found, maybe a .tgz file exist...
- ${WGETCMD} ${URL}/${PACK}.tgz
- if [ ${?} -eq 0 ]; then
- gztobz2 ${LFS_PKG_DIR}/${PACK}.tgz || return 1
- return 0
- else
- if detect_file_not_found; then
- # If file was not found, maybe a .tar.Z file exist... (uw-imap...)
- ${WGETCMD} ${URL}/${PACK}.tar.Z
- if [ ${?} -eq 0 ]; then
- gztobz2 ${LFS_PKG_DIR}/${PACK}.tar.Z || return 1
- return 0
- fi
- fi
- fi
- fi
+ for arch_ext in ${ARCH_EXT}; do
+ ${WGETCMD} ${URL}/${PACK}.${arch_ext}
+
+ # 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.
+ continue;
fi
- fi
- # Failure...
+ # If we arrive here, it means we were able to download the file.
+ if [ "x${arch_ext}" != "xtar.bz2" ]; then
+ gztobz2 ${LFS_PKG_DIR}/${PACK}.${arch_ext}
+ fi
+ return $?
+ done
+
+ # Failure or file not found
return 1
}
# Checking for correct number of arguments
if [ $# -ne 3 ]; then
echo "${FUNCNAME}(), wrong number of arguments: ${*}"
- return 1
+ reurn 1
fi
if [ ! -f ${LFS_PKG_DIR}/${TARGET}.tar.bz2 ]; then