X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=functions-update;h=916f239647425333042e7f7439a1873a2b9c8080;hb=049b8e35d7fd2eabb781f02b8022fdca43c980fb;hp=de02b74fb2ed570049a83e6b1f241714ae6f7bd7;hpb=f9cf3632a64429991fa5e6f556b0c4017e0e9435;p=hvlinux.git diff --git a/functions-update b/functions-update index de02b74..916f239 100644 --- a/functions-update +++ b/functions-update @@ -55,17 +55,25 @@ update_packages_init() 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 @@ -174,6 +182,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 @@ -196,42 +205,33 @@ static_getpkg() 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 } @@ -272,7 +272,7 @@ fpkg_mis() # 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