SUMMARY: tar

From: Jeff Kennedy <jlkennedy_at_amcc.com>
Date: Tue Oct 23 2001 - 09:18:49 EDT
Here's the real summary......

http://shells.devunix.org/~argoth/iaoq/#I.A1

I was reminded, and rightfully so, to never say Unix *can't* do
something.  As soon as you do you'll get bitten.

   1. How do I untar a file with absolute paths to a relative location?

            a. Method 1 (user)
                1. /usr/bin/pax -r -s ',^/,,' -f file.tar
            b. Method 2 (root)
                1. /usr/bin/cp /usr/sbin/static/tar /tmp
                2. /usr/bin/dd if=file.tar | /usr/bin/chroot /tmp ./tar
xf -

or....

mkdir /var/tmp/new/
cp /usr/sbin/static/tar /var/tmp/new
cp file.tar /var/tmp/new
chroot /var/tmp/new ./tar new.tar

Several people sent me the above.  One person sent me the following
little C program; standard disclaimer applies, use at your own risk, no
warranty given or implied, etc....

#include <stdio.h>

char block[512];

main(argc, argv)
int argc;
char **argv;
{
      register i;
      while (read (0, block, 512) == 512) {
          if (block[0] == '/' && block[99] == '\0') {
              for (i=0; i < 99; i++)
                      block[i] = block[i+1];
              block[99] = '/';
          }
          write (1, block, 512);
      }
}

Thanks again.

~JK

Jeff Kennedy wrote:
> 
> Thanks to Noel, John, David, David, and Derrick.
> 
> GNU Tar, star, and TRUE64's tar will do it, but not the standard Solaris
> tar.  SOL on this I guess.
> 
> Thanks.
> 
> ~JK
> 
> Jeff Kennedy wrote:
> >
> > If a tar file was created with an absolute path, is there a way to untar
> > it to a different path without linking?  Some switch perhaps that I
> > didn't understand in the man page?
> >
> > Thanks.

-- 
=====================
Jeff Kennedy
Unix Administrator
AMCC
jlkennedy@amcc.com
Received on Tue Oct 23 14:18:49 2001

This archive was generated by hypermail 2.1.8 : Wed Mar 23 2016 - 16:32:34 EDT