Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/bin/pax



On Sun, Oct 17, 2004 at 10:27:31PM +0200, Alan Barrett wrote:
> On Sun, 17 Oct 2004, David Laight wrote:
> > Modified Files:
> >     src/bin/pax: ar_subs.c extern.h options.c tar.1
> > 
> > Log Message:
> > Add an option --chroot to tar.  Causes it to chroot(".") before doing
> > an extract.
> 
> Will "tar -xf file.tar -C /destdir --chroot" chroot to /destdir ?
> Or do we have to do "(cd /destdir ; tar -xf - --chroot) <file.tar"
> to get that effect?

A lot of static analisis later.....

If -C destdir is specified, and there are no filename patterns (ie
extracting all the archive), then the chdir() will be done before
the chroot().

If there are filename patterns (extract different files to different
places) then the chdir() is done after the chroot() - ie when a file
matching the pattern is found.

So "tar -xf file.tar --chroot -C /destdir" will chroot to /destdir.
But "tar -xf file.tar --chroot -C /destdir '*'" will chroot to "."
and extract everything to ./destir

In any case I only needed
        cd /targetroot; tar --chroot -zxhep -f /path/set.tgz
to do something sensible when it found symlinks in the existing
directory tree (/targetroot is the root of the installed system).

The interaction of --chroot and -C dir is left as an excercise
to the reader!

        David

-- 
David Laight: david%l8s.co.uk@localhost



Home | Main Index | Thread Index | Old Index