ports/158179: some packages do not fully honor -P dir option in pkg_add(1)

Dieter BSD dieterbsd at engineer.com
Tue Jul 19 20:39:48 UTC 2011


>> 1. Spell out very clearly its purpose - is it to populate a jail, for
>> example?
>
> Populating a chroot/jail is one purpose.

Whoops, it occurs to me that using -P to populate a chroot/jail
would only work for simple cases.

There is the -C option, but it "needs to be a fairly
complete file system, including everything normally needed by
pkg_add to run" which could be problematic, as you may want the
chroot/jail to have the absolute minimum possible.

So to populate a chroot/jail we'd want to be able to specify
two directories: one for the real path, and one for the
after-chrooting path. The -c option is available.

Say a package has the binary bin/foo and the config file etc/foo.conf.
1) Pkg_add would install /usr/local/bin/foo and /usr/local/etc/foo.conf.
2) Pkg_add -P /bar would install /bar/bin/foo and /bar/etc/foo.conf.
3) Pkg_add -c /chroot would install /chroot/bin/foo and /chroot/etc/foo.conf.
4) Pkg_add -c /chroot -P /bar would install /chroot/bar/bin/foo and /chroot/bar/etc/foo.conf.

In cases 2 and 4, the foo binary would have to have some way to know to
look for foo.conf in /bar/etc rather than /usr/local/etc. Perhaps
CONFIG_PATH ? But in the general case, we'd need a lot of *PATHs.
Or a way to set PREFIX at install time. (But how?) Or...?


More information about the freebsd-ports mailing list