Installing multiple ports quietly and efficiently

Christopher Sean Hilton chris at vindaloo.com
Tue Oct 7 00:16:09 UTC 2008


On Oct 6, 2008, at 5:52 PM, Mel wrote:

> On Monday 06 October 2008 21:28:25 Kelly Jones wrote:
>> Here's one way to install multiple FreeBSD ports "unattended" on a
>> machine:
>>
>> cd /usr/port/foo/prog1; make install; cd/usr/ports/foo/prog2; make  
>> install
>>
>> and so on (perhaps even in a shell script). Two problems:
>>
>> % It's ugly. I'd prefer "cd /usr/ports; make foo/prog1 foo/prog2 ..."
>>
>> % "make install" often pops up windows asking me to choose
>> configuration options, and hangs until I do so.
>
> As others said, BATCH turns off config target. But don't
> clutter /etc/make.conf with stuff like that, cause you will forget  
> you put it
> there. make -DBATCH is short enough to type.
> It is however useful to inspect pkg-install files and set variables in
> either /etc/make.conf or /etc/(profile|login.conf). For example
> POSTFIX_DEFAULT_MTA will replace /etc/mail/mailer.conf when -DBATCH  
> is set.
> Over time you'll pick up quite a few of these that save you doing  
> the same
> thing all over.
>

Either one of:

      # cd /usr/ports/foo/bar; env BATCH=yes make install clean

of
      # cd /usr/ports/foo/bar; make -DBATCH install clean

will work. Both are cleaner than sticking "BATCH = yes" into /etc/ 
make.conf. You should watch out for three things here.

      1. This writes files into the ports database (/var/db/ 
something...) that sets the configuration of the port the knobs so to  
speak. So building for example postfix this way will get you a postfix  
that doesn't have SASL or LDAP or whatever you may actually want.  
Effectively this sets all the ports "knobs" to the defaults. To chose  
the knobs on a particular port visit the directory and run make config:

      # cd /usr/ports/mail/postfix; make config

Once you've got the port configured correctly you can run make clean;  
make deinstall; make install to build and reinstall it to your specs.

      2. You may not get exactly want you want. In fact the process my  
stall in the middle because of conflicts. In the nicest case you will  
end up with multiple ports that do the same thing. Building postfix  
with LDAP support for example is likely to result in two copies of the  
Berkeley Database port being installed. This is okay if they don't  
conflict. The build will fail if they do. I've seen this a lot on  
things that need LDAP. Some ports want version 2.3 and others want  
version 2.4 To get past this you need to figure out which  
WITH_<port>_VER/WANT_<port>_VER variables you need to tweak and for  
that you will need to add to /etc/make.conf

      3. You may not get all the pieces that you need. Note carefully  
that some ports are split into client and server pieces. This largely  
affects databases (MySQL / PostgreSQL).

-- Chris

Chris Hilton                                   e: chris|at|vindaloo| 
dot|com
----------------------------------------------------------------------------
                   "The pattern juggler lifts his hand; The orchestra  
begin.
       As slowly turns the grinding wheel in the court of the crimson  
king."
                                            -- Ian McDonald / Peter  
Sinfield





More information about the freebsd-questions mailing list