Ajout support zip pour static_decompressed_dirname()
authorgobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Tue, 15 Mar 2011 04:07:53 +0000 (04:07 +0000)
committergobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Tue, 15 Mar 2011 04:07:53 +0000 (04:07 +0000)
functions/main

index 7207157..ec42a71 100644 (file)
@@ -650,23 +650,27 @@ static_decompressed_dirname()
             continue;
         fi
 
+       local DIRNAME=""
+
         case ${arch_ext} in
            tar.bz2|tar.gz|tgz|tar.Z)
                 # Remove optional "./" leading component with sed
                 # and extract base directory name with awk.
                 # tar 1.23 reports an error when using pipes, so
                 # remove error message with "2> /dev/null"
-                local DIRNAME=$(tar ${TAR_OPTS} -tf \
+                DIRNAME=$(tar ${TAR_OPTS} -tf \
                     ${LFS_PKG_DIR}/${PACKAGE}.${arch_ext} 2> /dev/null | \
                     head -n1 | sed 's!^\./!!' | awk -F \/ '{print $1}')
-                echo ${DIRNAME}
                 ;;
             zip)
-                # TODO
-                echo ${PACKAGE}
+                DIRNAME=$(unzip -l \
+                    ${LFS_PKG_DIR}/${PACKAGE}.${arch_ext} | head -n4 | \
+                    sed '$!d' | awk -F " " '{print $4}' | sed 's!/$!!')
                 ;;
         esac
 
+        echo ${DIRNAME}
+
         return $?
     done