summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2006-01-21 18:01:26 +0000
committerjlam <jlam@pkgsrc.org>2006-01-21 18:01:26 +0000
commit9e65705d03e017f5c60929bd3b86456c57e2e8cb (patch)
tree797bacfc9e37610c4b7dd4a65ef06c8ae0c7b139 /mk
parent53a8e34feca7b6c24fdc40772bd4634167fbe7bd (diff)
downloadpkgsrc-9e65705d03e017f5c60929bd3b86456c57e2e8cb.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')
-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"