FreeBSD non-interactive installs with pkg_add

Howdy all,

I know we’ve got some FreeBSD users here, so I’m hoping one of you can lend me a clue. I’m (finally) nearly finished with the installer for FreeBSD, but, it stops about 30 times during installation waiting for user interaction (yes or no to various questions during the installation of packages–these are questions that I generally know the answer to, but our end users probably won’t, so obviously I’d like to be able to answer them via the script, or simply leave the configuration they do undone and fix it during our configuration phase). There is no non-interactive flag to pkg_add, and my google fu is not strong enough to find a solution. How does one perform batch installations of packages on FreeBSD?

Note that ports will be used for at least one or two of the packages–and I know a lot of folks prefer ports for everything, and replacing the pkg_add installed packages with ports later will not cause any problems–but it’s actually even WORSE than pkg_add when it comes to running it non-interactively, as it asks questions using a curses interface rather than simple yes/no (which can be overcome via some ugliness, which I’m hoping to avoid).

There must be a way to perform automated pkg or port installations on FreeBSD…but I’ve spent the past three days searching (and several attempts over the past year) to no avail.


Answering my own question, pkd_add can be run with the -I option to skip running post/pre install scripts. This leaves some configuration undone, but we can fix that in our own post-install script. FreeBSD installer, here we come…

If you need a beta test platform let me know… I’ve horribly messed up my latest manual attempt to duplicate on FreeBSD the config your normal install script provides on CentOS et. al. and I’m ready to wipe and start over.