summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorXavier Chantry <shiningxc@gmail.com>2009-08-05 16:12:46 +0200
committerDan McGee <dan@archlinux.org>2009-09-06 15:33:54 -0500
commit7ddb645bd7cf7e1c56a508321df511864da411a4 (patch)
treeb9235219648a3ecbd76bb350f34a071cdccc078e /scripts
parenta05757f984f526233e90a774beb571dba8270ff0 (diff)
makepkg: always keep sources symlinks
Make bunzip2/xz/gunzip decompressing to stdout, because gzip does not offer something like a -k option. The selection of the decompression command for gzip/bzip2/xz compressed files now also depends on the file suffix, since we need to strip the extensions to get the output filename. Thanks to Cedric Staniewski <cedric@gmx.ca> for reporting this issue and contributing patches. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/makepkg.sh.in27
1 files changed, 21 insertions, 6 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 126379ac..80d38670 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -646,16 +646,26 @@ 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" ;;
+ cmd="bsdtar" ;;
*application/x-gzip*)
- cmd="gunzip -d -f" ;;
+ case "$ext" in
+ gz|z|Z) cmd="gzip" ;;
+ *) continue;;
+ esac ;;
*application/x-bzip*)
- cmd="bunzip2 -f" ;;
+ case "$ext" in
+ bz2|bz) cmd="bzip2" ;;
+ *) continue;;
+ esac ;;
*application/x-xz*)
- cmd="xz -d -f" ;;
+ case "$ext" in
+ xz) cmd="xz" ;;
+ *) continue;;
+ esac ;;
*)
# Don't know what to use to extract this file,
# skip to the next file
@@ -663,8 +673,13 @@ extract_sources() {
esac
local ret=0
- msg2 '%s' "$cmd \"$file\""
- $cmd "$file" || ret=$?
+ msg2 "$(gettext "extracting %s with %s")" "$file" "$cmd"
+ if [ "$cmd" = "bsdtar" ]; then
+ $cmd -xf "$file" || ret=?
+ else
+ rm -f "${file%.*}"
+ $cmd -dcf "$file" > "${file%.*}" || ret=?
+ fi
if [ $ret -ne 0 ]; then
error "$(gettext "Failed to extract %s")" "$file"
plain "$(gettext "Aborting...")"