View Single Post
  #2   (View Single Post)  
Old 25th July 2011
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default

You can use -P, from pkg_add(1)

Code:
     -p, --prefix prefix
             Set prefix as the directory in which to extract files from a
             package.  If a package has set its default directory, it will be
             overridden by this flag.  Note that only the first @cwd directive
             will be replaced, since pkg_add has no way of knowing which
             directory settings are relative and which are absolute.  It is
             rare in any case to see more than one directory transition made,
             but when such does happen and you wish to have control over *all*
             directory transitions, then you may then wish to look into the
             use of MASTER and SLAVE modes (see the -M and -S options).  If
             the -p flag appears after any -P flag on the command line, it
             overrides its effect, causing pkg_add not to use the given prefix
             recursively.

     -P prefix
             Does the same as the -p option, except that the given prefix is
             also used recursively for the dependency packages, if any.  If
             the -P flag appears after any -p flag on the command line, it
             overrides its effect, causing pkg_add to use the given prefix
             recursively.
Note the difference between small -p and capital -P.

Code:
[~]# pkg_add -fP/tmp/test/ pciids-20101124.tbz

[/tmp/test]% find . -type f
./share/pciids/pci.ids
./share/licenses/pciids-20101124/catalog.mk
./share/licenses/pciids-20101124/LICENSE
./share/licenses/pciids-20101124/BSD
./share/licenses/pciids-20101124/GPLv2
./share/licenses/pciids-20101124/GPLv3
Note that PREFIX is defined at compile-time. Depending on the application, it may or may not run from another directory...
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote