fivemack: (Default)
Tom Womack ([personal profile] fivemack) wrote2006-11-06 03:18 pm
Entry tags:

Creating useful .tar files

Is there some series of command-line options to 'tar' which lets me create a tar file which contains the file called (with respect to the current directory) X/Y/Z/foo.baz but in such a way that, when my end-user unpacks the tar file, it comes out as R/S/bar.quux ?

It seems a natural thing for anyone doing packaging to want to do; the GNU info page for tar appears to be a dreadful combination of inadequate tutorial and inadequate reference manual, and I've been unable to figure out what to do merely by reading it.
(deleted comment)
simont: A picture of me in 2016 (Default)

[personal profile] simont 2006-11-06 05:32 pm (UTC)(link)
Hard linking is probably overkill; my usual approach is to symlink and use tar -h. Of course this fails if you also wanted your tar file to contain some real symlinks, at which point you probably do need to fall back to hard links or LD_PRELOAD or other diverse evils; but it works for my usual purposes at least.
redbird: closeup of me drinking tea, in a friend's kitchen (Default)

[personal profile] redbird 2006-11-06 03:40 pm (UTC)(link)
I think [livejournal.com profile] met24 is right; you could throw together a script to create the links and then run 'tar'.
ext_8103: (Default)

[identity profile] ewx.livejournal.com 2006-11-06 04:30 pm (UTC)(link)
Things like libtricks (which used LD_PRELOAD to mess with a dynamically linked program's view of the world) might be able to help, but Martin's suggestion is the simplest approach.