Subject: Re: change to pkg_install
To: Matthias Scheler <tron@lyssa.owl.de>
From: Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de>
List: tech-pkg
Date: 05/31/1999 13:00:12
On 31 May 1999, Matthias Scheler wrote:
> >> > replaced with "@cwd <PREFIX>", if you need a @cwd or two in your PLIST,
> >> > just duplicate the first one.
> >> That won't help for binary packages unfortunately.
> > Last time i tried it, it did.
> How can it? "tar" can't change the directory while extracting an archive.

Oh, it can, if you give it the right switches. :-)
(With gtar, though, not with pax; which is why I'm saying that pax is not
pkg-ready).

Assume you have a PLIST as:

@cwd /etc
passwd
@cwd /bin
ls

This will result in a binary package tar file as:

passwd
ls

Note the absence of paths! Now when you pkg_add this, what actually
happens is:

 - the tar file is extracted to some temporary staging area
 - move first bunch into place: passwd -> /etc
 - move second bundh into place: ls -> bin

The latter two steps are done in one tar command:
tar cf - passwd ls | tar -xf - -C /etc passwd -C bin ls

note the double use of the -C switch - this is what pax doesn't do.


 - Hubert

-- 
NetBSD - Better for your uptime than Viagra