[RFC] Remove pkg_add -C (chroot functionality)

Tim Kientzle kientzle at freebsd.org
Thu Apr 8 02:36:12 UTC 2010


Garrett Cooper wrote:
>     There's an outstanding bug to fix chroot(2)'ing functionality with
> pkg_add(1) [1]. Anyone that has tried this functionality knows that
> it's currently crippled

If it's currently broken, it's better to
simply remove it.

I'm not sure I understand why anyone wants
pkg_add to call chroot(2) at the top, though.
As you pointed out, "chroot pkg_add" exists
already.

The feature we need should:
  * update $ROOTDIR/var/db/pkg
  * Add $ROOTDIR as a prefix to all installed file locations
This would allow pkg_add when running outside of
a chroot to install packages into a chrooted
system, which is what you can't easily do with
"chroot pkg_add".

Of course, this isn't particularly easy to do when
forking tar(1), so the libarchive integration
might be a necessary prerequisite.  (Command-line
tar doesn't support re-rooting absolute paths.
There is a --chroot option to tar, but it's
currently broken in some rather complex ways.
As I'm composing this message, I'm starting to
wonder if it also should not use chroot(2).
Hmmm....)

The hard part is @exec/@unexec.  On the one
hand, you don't necessarily want to require
the install dependencies of a package to be
installed in the chroot, which argues against
running those under chroot(2).  On the other hand,
a lot of the commands used within @exec/@unexec
manipulate common system databases (e.g., ldconfig),
which argues that those commands should be run
under chroot(2).

Cheers,

Tim



More information about the freebsd-arch mailing list