The selection of the decompression command for gzip/bzip2/xz
compressed files now also depends on the file suffix, since the
decompression programs rely on them when not using -c option.

Signed-off-by: Cedric Staniewski <[email protected]>
---
 scripts/makepkg.sh.in |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 2f1db38..702e4c1 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -641,16 +641,23 @@ extract_sources() {
 
                # fix flyspray #6246
                local file_type=$(file -bizL "$file")
+               local ext=${file##*.}
                local cmd=''
                case "$file_type" in
                        
*application/x-tar*|*application/zip*|*application/x-zip*|*application/x-cpio*)
                                cmd="bsdtar -x -f '$file'" ;;
                        *application/x-gzip*)
-                               cmd="gunzip -c -f '$file' > '${file%.*}'" ;;
+                               [ "$ext" = "gz" -o "$ext" = "z" -o "$ext" = "Z" 
] \
+                                       && cmd="gunzip -cf '$file' > 
'${file%.*}'" \
+                                       || continue ;;
                        *application/x-bzip*)
-                               cmd="bunzip2 -f -k '$file'" ;;
+                               [ "$ext" = "bz2" -o "$ext" = "bz" ] \
+                                       && cmd="bunzip2 -fk '$file'" \
+                                       || continue ;;
                        *application/x-xz*)
-                               cmd="xz -d -f -k '$file'" ;;
+                               [ "$ext" = "xz" ] \
+                                       && cmd="xz -dfk '$file'" \
+                                       || continue ;;
                        *)
                                # Don't know what to use to extract this file,
                                # skip to the next file
-- 
1.6.4

_______________________________________________
pacman-dev mailing list
[email protected]
http://www.archlinux.org/mailman/listinfo/pacman-dev

Reply via email to