4

I'm new to FreeBSD, coming from a Linux background. I want to install a port, changing one of the default configuration options, in a non-interactive way (so that I can script the installation for automated configuration of my FreeBSD servers).

As a specific example, the graphics/ImageMagick-nox11 port has a default configuration option of PERL=on. I want to change this. I realize that I can make config and then just use the generated entry in /var/db/ports/ to avoid any interaction in the future, but this still requires the initial interaction to set the options in the ncurses interface.

Ideally I want to be able to do something like the following, to build the package with perl support disabled but accepting all other defaults:

$ make PERL=off BATCH=yes install clean

What is the proper way to accomplish this? Can I somehow place port-specific configuration options like this in /etc/make.conf?

2 Answers 2

2

I think ports-mgmt/portconf will do what do you want:

Portconf is a simple framework to set ports options in an universal way. Knobs set to specific ports are honoured by portmaster, portupgrade, portmanager and 'make install'.

Check more in pkg-message.

2
  • That looks promising, but I don't understand the entry format. Should I do something like graphics/ImageMagick-nox11: !PERL in my ports.conf?
    – oakservice
    Sep 8, 2014 at 17:20
  • I've tried it some time ago but I don't use it - I don't remember but check pkg-message as I wrote above. But I think it will not perfect for you because if you have a port without options in DBDIR, will ask if portconf doesn't specify all options. But one another possibility: ports-mgmt/portmaster. It has -G option which prevents make config.
    – uzsolt
    Sep 9, 2014 at 5:59
0

You can add the following to your /etc/make.conf:

.if ${.CURDIR:M*/graphics/ImageMagick-nox11}
WITHOUT="PERL"
.endif

This checks if the current directory is the graphics/ImageMagick-nox11 directory and then sets WITHOUT="PERL" only when this port is build.

2
  • If I do this make showconfig still shows PERL=on. Would this not come into effect until I actually make install?
    – oakservice
    Sep 8, 2014 at 17:21
  • Ahh sorry WITH_PERL was the old style. Now its WITHOUT="PERL, PYTHON..." or WITH="PERL, PYTHON...". Sep 9, 2014 at 4:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .