site  contact  subhomenews

tar transform

February 24, 2009 — BarryK
Thanks to labrador who posted a solution to expanding a .pet directly to '/' in reply to a recent blog post. Using the '--transform' option of tar.

So why didn't I know about --transform? Well, it isn't in the man page, not in the one I have anyway. Looking online, I also found '--strip 1' works:

http://www.gnu.org/software/tar/manual/html_section/transform.html

'--strip' isn't in my man page either.

To use --strip, move the tarball to '/', then:

# tar -z -x --strip=1 -f packagename.tar.gz

Comments

There's a problem with --strip
Username: labrador
--strip option works perfectly in most cases. However, some packages, which were not built with programs like new2dir, could include ./ at the beginning of every file. This kind of packages has no problem with the original tar/cp method, but you need --strip 2 rather than --strip 1 to remove package names properly. Here's an example of such package: http://www.murga-linux.com/puppy/viewtopic.php?t=37419.


Tags: woof