This time a more tested patch... Probably someone knows a possibility to quote the file name in the cmd string so that the characters are recognized as quoting chars and not as part of the filename without using eval.
>From 0aad0c6f6030806cea1804152afc0650d491b307 Mon Sep 17 00:00:00 2001 From: Cedric Staniewski <[email protected]> Date: Wed, 5 Aug 2009 12:43:03 +0200 Subject: [PATCH] makepkg: always keep sources symlinks Add -k (keep) option to the bunzip2/xz commands and make gunzip decompressing to stdout, because it does not offer something like a -k option. Additionally 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 | 36 ++++++++++++++++++++++++------------ 1 files changed, 24 insertions(+), 12 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 56ad2c0..c7a6434 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -644,22 +644,34 @@ extract_sources() { local cmd='' case "$file_type" in *application/x-tar*|*application/zip*|*application/x-zip*|*application/x-cpio*) - cmd="bsdtar -x -f" ;; - *application/x-gzip*) - cmd="gunzip -d -f" ;; - *application/x-bzip*) - cmd="bunzip2 -f" ;; - *application/x-xz*) - cmd="xz -d -f" ;; + cmd="bsdtar xf '$file'" ;; *) - # Don't know what to use to extract this file, - # skip to the next file - continue;; + case "$file" in + *.gz|*.z|*.Z) + [[ "$file_type" = *application/x-gzip* ]] \ + && cmd="gunzip -cf '$file' > '${file%.*}'" \ + || continue + ;; + *.bz2|*.bz) + [[ "$file_type" = *application/x-bzip* ]] \ + && cmd="bunzip2 -fk '$file'" \ + || continue + ;; + *.xz) + [[ "$file_type" = *application/x-xz* ]] \ + && cmd="xz -dfk '$file'" \ + || continue + ;; + *) + # Don't know what to use to extract this file, + # skip to the next file + continue ;; + esac esac local ret=0 - msg2 '%s' "$cmd \"$file\"" - $cmd "$file" || ret=$? + msg2 '%s' "$cmd" + eval $cmd || ret=$? if [ $ret -ne 0 ]; then error "$(gettext "Failed to extract %s")" "$file" plain "$(gettext "Aborting...")" -- 1.6.4 _______________________________________________ pacman-dev mailing list [email protected] http://www.archlinux.org/mailman/listinfo/pacman-dev
