Déplacé Evince au stage 5 (ne requiert pas Gnome)
[hvlinux.git] / functions / fpkg
index c420d7b..dd855d9 100644 (file)
@@ -165,8 +165,8 @@ detect_file_not_found()
 {
     # HTTP: will return "ERROR 404: Not Found"
     # FTP: will say "File not found" or "No such file"
-    if grep --ignore-case -e "not found" -e "no such file" ${WGET_LOG_FILE} \
-        1> /dev/null 2>&1; then
+    if grep -q --ignore-case -e "not found" -e "no such file" ${WGET_LOG_FILE}; \
+        then
         #echo "404 NOTFOUND"
         return 0
     fi
@@ -215,8 +215,7 @@ static_getpkg()
 
         # 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
+        if grep -q "failed: Connection timed out" ${WGET_LOG_FILE}; then
             echo "Error, wget reported: Connection timed out"
             return 1
         fi
@@ -264,8 +263,8 @@ test_archive_integrity()
     local FILE=${2}
     local EXT=${3}
 
-    if [ ! -f ${FILE} ]; then
-        # The file may be absent, in this case simply abort without error
+    if [ ! -f ${FILE} -o -h ${FILE} ]; then
+        # The file may be absent, or a symbolic link. Abort without error
         return 0
     fi
 
@@ -275,8 +274,12 @@ test_archive_integrity()
         TESTCMD="bzip2 -t"
     elif is_archive_tar_gzip "${EXT}"; then
         TESTCMD="gunzip -t"
+    elif [ "x${EXT}" = "xtar.xz" ]; then
+        TESTCMD="unxz -t"
+    elif [ "x${EXT}" = "xzip" ]; then
+        TESTCMD="unzip -t"
     else
-        # Can only test gzip and bzip2 archives
+        # Can only test gzip, bzip2, xz and zip archives.
         return 0
     fi
 
@@ -384,7 +387,7 @@ fpkg()
                     # Default subdirectory on server
                    SRC_DIR=$(get_pkg_name ${PACK})
                 fi
-                SRC_DIR="${SRC_DIR}/$(get_pkg_ver_base ${PACK})"
+                SRC_DIR="${SRC_DIR}/$(get_pkg_ver2 ${PACK})"
                 ;;
             sf)
                 URL=${SOURCEFORGE_URL}
@@ -550,9 +553,10 @@ fpkg()
 
         # 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
+        local PATCHES_LIST="${LFS_PKG_DIR}/${SRC_FILENAME}-*.patch"
+        if ls ${PATCHES_LIST} 1> /dev/null 2>&1; then
+            echo "CMD=${SRC_FILENAME} ${PACK} ${PATCHES_LIST}"
+           rename ${SRC_FILENAME} ${PACK} ${PATCHES_LIST}
         fi
     fi
 }