Finalisation Wifi selon tests concluants du HP-Mini
[hvlinux.git] / functions / fpkg
index f637f54..cffb6f1 100644 (file)
@@ -76,6 +76,11 @@ update_packages_init()
         return 0
     fi
 
+    if [ ! -x /usr/bin/wget ]; then
+       echo "${FUNCNAME}() error, the wget package was not found."
+       return 1
+    fi
+
     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}
@@ -158,17 +163,15 @@ static_getpatch()
 
 detect_file_not_found()
 {
-    # HTTP: will return error code 404.
+    # HTTP: will return "ERROR 404: Not Found"
     # FTP: will say "File not found"
-    if grep "404" ${WGET_LOG_FILE} 1> /dev/null 2>&1; then
-        #echo "404 NOTFOUND"
-        return 0
-    elif grep "No such file" ${WGET_LOG_FILE} 1> /dev/null 2>&1; then
-        #echo "No such file"
+    if grep --ignore-case "not found" ${WGET_LOG_FILE} \
+        1> /dev/null 2>&1; then
+        echo "404 NOTFOUND"
         return 0
-    else
-        return 1
     fi
+    
+    return 1
 }
 
 # Get package if it is not in the repository
@@ -203,7 +206,8 @@ static_getpkg()
         # so we can safely remove any file prior to trying to download it.
         rm -f ${LFS_PKG_DIR}/${PACK}.${arch_ext}
 
-        rcmd "Fetching ${PACK}.${arch_ext}" ${WGETCMD} ${URL}/${PACK}.${arch_ext}
+        rcmd "Fetching ${PACK}.${arch_ext}" \
+            ${WGETCMD} ${URL}/${PACK}.${arch_ext}
         wget_status=$?
 
         # Append log to global log file