[SUMMARY] Clarification: tar extraction question

From: Bruce Bowler (bbowler@bigelow.org)
Date: Thu Mar 18 1999 - 13:08:01 CST


Yesterday I asked...

>>Is there a way to make the tar that comes with solaris extract files to .
>>regardless of the path they were on when the archive was made?
>>
>>On our OSF system the -P option could be used to strip leading directory
info
>>from a file either during archiving or during extraction. I'm wondering
>if a
>>similar facility exists with solaris tar and I just missed it reading the
>man
>>page.
>
>If I have a tar file that has in it a, /b/c/d, and /e/f/g
>
>I'm looking for a tar command that extract all 3 files as ./a, ./d and ./g.
> In this particular instance, I'm only partially interested in ./a,
>./b/c/d, and ./e/f/g (the 'chroot' method) and not the least bit interested
>in ./a, /b/c/d and /e/f/g (the default method).
>
>Oh, also this is for Solaris 2.5.1.
>
>Sorry for not being clear on all of this the first time around.

thanks to Harvey Wambolt, Mark L. Summers, dana@dtn.com, Kevin Korb,
Michael Maciolek, James Neal, Sherman Schorzman, Frank Smith, Seth
Rothenberg, Thad MacMillan, Jon M. Hayden, foster@biall.ucsd.edu, Brian
Sherwood, Matthew Stier, Steve Butterfield, Vince Merrell, David Evans, Jim
Musso, Dennis Martens, Dave Carrigan, Stefan Voss, Anthony Worrall, George
Elting and most of all, Stephen P Richardson. If I left anyone off, I'm
sorry, it wasn't intentional (sounds kind of like and Oscar acceptance
speach :-)

Short answer. Can't do it with basic solaris tools (I'm not too surprized).

Medium answer. Get gnutar and eat up another megabyte or more of disk
space and still not have what I'm looking for.

Long answer (and the reason Stephen Richardson gets special thanks. He's
also the only one of the above who realized that what I really want to do
is flatten the directory tree during the extraction process). It would
appear that I might be able to use cpio to do it (although I haven't tried
it yet) since it has the ability to read tar files and rename the output
files "on the fly".

Longest answer. Either write my own tar that does what I want (shouldn't
be too bad given the wealth of tar packages available) or write/find a tool
that will edit the tar file itself (much scarier proposition).

At this point I'm leaning towards writing my own (specialized) tar, mostly
for the challenge of it.

The chroot option that several folks suggested won't work in my case since
the overall procedure that the extraction will be part of must be runnable
by normal users.

Bruce Bowler 207.633.9600 (voice)
Research Associate 207.633.9641 (fax)
Bigelow Laboratory for Ocean Sciences bbowler@bigelow.org
West Boothbay Harbor ME 04575 http://www.bigelow.org/



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:16 CDT