summaryrefslogtreecommitdiff
path: root/mk/scripts/extract
diff options
context:
space:
mode:
authorjlam <jlam>2006-01-21 18:01:26 +0000
committerjlam <jlam>2006-01-21 18:01:26 +0000
commit9ce9293ebc7a65d7f2b95833df1fb50d7f3a599f (patch)
tree797bacfc9e37610c4b7dd4a65ef06c8ae0c7b139 /mk/scripts/extract
parent7ef79beedae4fe1c6326b4c1cd0ddded36da8549 (diff)
downloadpkgsrc-9ce9293ebc7a65d7f2b95833df1fb50d7f3a599f.tar.gz
Teach the extract script how to exclude files specified on the command
line from extraction when using tar (it already knew how to do it for pax).
Diffstat (limited to 'mk/scripts/extract')
-rwxr-xr-xmk/scripts/extract16
1 files changed, 14 insertions, 2 deletions
diff --git a/mk/scripts/extract b/mk/scripts/extract
index fcde98aeac7..ff7411b373f 100755
--- a/mk/scripts/extract
+++ b/mk/scripts/extract
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: extract,v 1.11 2006/01/21 16:48:10 jlam Exp $
+# $NetBSD: extract,v 1.12 2006/01/21 18:01:26 jlam Exp $
#
# Copyright (c) 2006 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -98,9 +98,11 @@
: ${LHA:=lha}
: ${MKDIR:=mkdir}
: ${PAX:=pax}
+: ${RM:=rm}
: ${SH:=sh}
: ${TAR:=tar}
: ${TEST:=test}
+: ${TMPDIR:=/tmp}
: ${UNRAR:=unrar}
: ${UNZIP:=unzip}
: ${UNZOO:=unzoo}
@@ -202,12 +204,22 @@ tar)
/*) tarprog="$extract_using" ;;
*) tarprog="${TAR}" ;;
esac
+ tmpfile=
+ if ${TEST} "$exclude" = "yes"; then
+ tmpfile="${TMPDIR}/$self.$$"
+ ${RM} -f "$tmpfile"
+ for i in "$@"; do
+ ${ECHO} "$i" >> "$tmpfile"
+ done
+ exclude_file="$tmpfile"
+ fi
if ${TEST} -n "$exclude_file"; then
exclude_flag="-X $exclude_file"
set -- dummy; shift
fi
$decompress_cat "$distfile" |
- $tarprog ${EXTRACT_OPTS_TAR} $exclude_flag -xf - "$@"
+ $tarprog ${EXTRACT_OPTS_TAR} $exclude_flag -xf - "$@" \
+ && ${RM} -f $tmpfile
;;
*)
${ECHO} 1>&2 "$self: unknown tar program: $extract_using"