I want to automate installation of ports in my FreeBSD environment. Usually I take the default settings but for some ports I want to -automatically- select all options.
Is it possible to do something like
/usr/ports/.../> make config
/usr/ports/.../> ** select all options **
/usr/ports/.../> make clean install BATCH=yes
in a script?
There is no automatic way to do that. The whole point of the config system is to make the operator choose which options to pick.
And since the ports system now also supports multiple choice options, you cannot always select all options. From /usr/ports/Mk/bsd.options.mk
:
# OPTIONS_SINGLE - List of single-choice grouped options: 1 and
# only 1 among N
# OPTIONS_RADIO - List of radio-choice grouped options: 0 or 1
# among N
# OPTIONS_MULTI - List of multiple-choice grouped options: at
# least 1 among N
# OPTIONS_GROUP - List of group-choice grouped options: 0 or
# more among N
However, the options once set remain valid until a port update changes the names or number of options. So in general you don't have re-run make config
for every build.
One thing you could try is to generate the necessary /var/db/*/options
files (with the latest port revision in _OPTIONS_READ
) yourself before calling make install clean
.
This depends on correctly parsing the port's Makefile. And which option are you going to pick in an OPTIONS_SINGLE?
Note: You can define BATCH
when calling make
to build a port. This should skip those ports which require interaction. But if I'm reading /usr/ports/Mk/bsd.port.mk
correctly, it will build the ports with the default settings.