diff options
author | jlam <jlam> | 2006-01-21 18:01:26 +0000 |
---|---|---|
committer | jlam <jlam> | 2006-01-21 18:01:26 +0000 |
commit | 9ce9293ebc7a65d7f2b95833df1fb50d7f3a599f (patch) | |
tree | 797bacfc9e37610c4b7dd4a65ef06c8ae0c7b139 /mk | |
parent | 7ef79beedae4fe1c6326b4c1cd0ddded36da8549 (diff) | |
download | pkgsrc-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')
-rwxr-xr-x | mk/scripts/extract | 16 |
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" |