神刀安全网

proot: dpb meets chroot

Contributed by tj on Sat Apr 30 16:32:59 2016 (GMT)
from the chroot-everything dept.

With the p2k16 hackathon just coming to a close, Marc Espie has revealed one of the new things he worked on.

I’ve been using dpb(1) chroot’d for a long time, using my own methods. This is a first try at making things "simple." Basically,

proot -B /build

should more or less do something sane, and then you can build ports in that chroot.

If you don’t pass any more options, it will copy enough files from your current working system, and… that’s more or less it!

Well, it doesn’t deal with copying the ports tree, because most often you will want to check it out, or copy it manually.

proot invokes a series of actions, you get to decide what you want… see the manpage. The nitty-gritty options (makedev, ldconfig) you very often won’t touch.

What you want to do is:

– figure out if you want to get release copied over based on the system locate databases, or based on a snapshot.

– figure out whether you want to copy ports over, check it out thru cvs, or do your own thing.

– provide specific variables if some of your ports tree lives in a funny place.

For cluster-based builds, you have to figure out your nfs and file system options first, then use proot. It will try as much as possible not to perturb mounts within the chroot.

For performance reasons, it does hardlinks to files when it can, so that it’s cheap to clone chroot (this will integrate with dpb later).

It will also give files to proper users. If you deal with an actual ports tree, you want to give PORT_USER to you (proot wants to be run as root, duh). The other stuff will automatically belong to _pfetch or _pbuild accordingly.

Right now, I have a config file that just says:

chroot=/home/build PORT_USER=espie WRKOBJDIR=/pobj

and my local dpb host file is very short

PORT_USER=espie DEFAULT chroot=/home/build localhost

and this works.

On a slightly more complex setup, I have:

chroot=/build preserve=/usr/ports PORT_USER=espie PORTSDIR=/source/ports WRKOBJDIR=/tmp/pobj LOCKDIR=/tmp/locks PLIST_DB=/data/p/plist DISTDIR=/distfiles actions=unpopulate

with a dpb hosts file:

STARTUP=%p/cleanup LOG_USER=espie DEFAULT chroot=/build localhost openbsd-2 openbsd-3

(that setup has /build/source, /build/data/p, /build/distfiles as separate filesystems that get exported thru NFS, and /build/tmp is an async fs on every machine)

Note that you need to be fairly current. I did commit stuff to dpb(1) to make sure it uses _pfetch/_pbuild by default, and there are more tweaks to come yet…

Though still a fast moving target in terms of development, you can get your hands on proot with a -current ports tree now and start testing.

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » proot: dpb meets chroot

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址