Jails and common ports
Marcus I. Ryan
marcus at riboflavin.net
Thu Nov 20 14:50:26 PST 2008
Cross-posting this to freebsd-ports because it's mostly about the
ports infrastructure and how I might (ab)use it...
I'm looking into setting up jails, and was hoping I was onto something
with using ports to maintain application software but I hit a snag and
I'm hoping someone can either tell me how to do what I want or at
least say "nope...you're on crack thinking that will work" ;)
I'm trying to set up a number of jails on my system following the
handbook suggestions for "Application of Jails"
(http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails-application.html). That means I have a master read-only instance for the base system (world), and read-write instances of key directories for each jail. This is ideal for what I'd like to do because I only have to do one world upgrade to upgrade all my
I'd like to extend that idea to a number of common ports. For
instance, I'd like to have gettext, libtool, etc., installed once and
be able to do a single portupgrade to update it for all jails.
My initial plan was to make an /opt folder in the master filesystem
and use the master jail to install ports (PREFIX=/opt and
LOCALBASE=/opt). I added the /opt/bin and /opt/sbin to the path and
/opt/lib to the ld_config directories for the child jails and they
were indeed able to see the first couple of ports I installed.
However, I started hitting issues with libtool and friends. The
children would not find them, and would go ahead and start installing
their own local copies of those ports. Turns out quite a few tools
are defined in /usr/ports/Mk/* and are defined relative to LOCALBASE.
If I leave LOCALBASE and PREFIX alone in the child jails so they'll
use /usr/local for their specific ports, I can't recognize and use
other ports like libtool installed in /opt; it doesn't seem right to
set LOCALBASE in the child jails since I want them to use /usr/local
for anything I haven't provided.
I really would like to avoid the "joy" of making hard-links, etc., for
all the files in the common packages, but I didn't see any way to
override settings for these individual ports. I did edit some
Makefiles and add '--prefix=/opt' to the CONFIGURE_ARGS for those
ports, and everything worked fine, but I'd prefer to do it "the right
way" (e.g. not editing Makefiles).
Is there a variable I'm not seeing that would allow me to do this kind
of crazy thing, or am I better off either setting up hard links and/or
using automated package building and just repeating pkg_upgrades in
If it's the latter, does someone know of a decent all-in-one doc to
help me at least set up some features so I update ports once in a
master and just get packages from the same place (I can piece it
together myself from all the other docs I've found and been reading,
but if someone has already written it up, hate to reinvent it myself
Thanks in advance.
Marcus I. Ryan, marcus at riboflavin.net
People often find it easier to be a result
of the past than a cause of the future.
More information about the freebsd-questions