make installjail maybe?

Matthew Seaman m.seaman at infracaninophile.co.uk
Thu Oct 16 00:54:04 PDT 2003


On Thu, Oct 16, 2003 at 02:28:00AM -0500, John wrote:
> Is anyone working on someway to install ports into a jail? What i do most of
> the time for a small port (like bind or something) is i redefine PREFIX to
> be /usr/jail/$ip, but there are a few problems with this.
> 
> 1. named now looks for /usr/jail/$ip/etc/named.conf by default. Not that that
> is hard to get around, but just a fyi.
> 2. You can't install the port more then once without messing around with 
>  the package install info (the stuff in /var/db/pkg). I've just been moving
> the package name from say bind-8.3.6 to bind-8.3.6-jail-path-to-jail-root, but 
> that is a little ugly ;).
> 3. libs, passwd files, group (basicly userland). Most of the time i just cheat
> and staticly link the port ( setenv CLFAGS "-static"). This works fine for bind
> , but i haven't tested other apps. Then i copy the other userland bits.
> maybe if there was a port that would just install a mini user land, based off
> /usr/src or something like that i wouldn't need to staticly link everything.

There's two ways of looking at this.

If you have a 'thick' jail -- essentially with a complete FreeBSD
environment inside it, then you can just ssh(1) into the jail and
install ports exactly as you would in the base system.  To save space
you can use mount_null(8) to remount /usr/ports from the base inside
the jail -- this works well so long as you don't try installing ports
simultaneously fron the jail and the base system, although by setting
WRKDIRPREFIX in both environments you can even do that.

To avoid compiling ports common to the jail and the base several
times, just create packages in (say) the base, and pkg_add(1) them
from the jail.  portupgrade(1)'s pkgtools.conf will let you
automatically control using packages or ports down to the level of
individual ports.

For a thin jail -- ie. without a sufficiently complete environment
that you can compile stuff inside the jail (or even if you do, but
find this method preferable) then create a .../db/pkg directory for
your jail (doesn't have to be inside the jailed area, although that
doesn't hurt).  Then simply set PKG_DBDIR in your environment to that
directory:

    # setenv PKG_DBDIR /usr/jail/${ip}/var/db/pkg

and install ports or packages using a similarly modified $PREFIX as
before.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20031016/9a4d79a4/attachment.bin


More information about the freebsd-ports mailing list