Automating FreeBSD Install, setting ports configure options recursively

I am attempting to write a script that will automatically install ports that I commonly use.

I can override the options set in the in the Makefile by using OPTIONS_SET=SOMEVARIABLE. So for instance, if I want to configure portmaster to not support ZSH, I would use the command make OPTIONS_UNSET=ZSH -DBATCH make install clean and it will install portmaster without ZSH support.

Now, for the more complex ports that have dependencies that also need to configure, how can I recursively configure them?

Ultimately, I just want exclude DOCS and EXAMPLES from being built (I'm going for the smallest build possible)
 
Now, if I do that, I assume it will be global meaning DOCS and EXAMPLES will be unset for everything. If I happen to want DOCS enabled for something, say, sudo, how can I enable it using the method I described in my original question? I just tested and it refuses to enable an option unset in /etc/make.conf
 
You should be able to run make -C /usr/ports/security/sudo config, for example, and still enable on a per-port basis options that were unset with OPTIONS_UNSET. What is making you say it is "refusing to set"?
 
You should be able to run make -C /usr/ports/security/sudo config, for example, and still enable on a per-port basis options that were unset with OPTIONS_UNSET. What is making you say it is "refusing to set"?


I'm trying to do this via command line. So, if I set OPTIONS_UNSET = DOCS EXAMPLES in /etc/make.conf and then I issue the command make OPTIONS_SET=DOCS config, the "gui" screen comes up and DOCS remains unset. I can manually set it from here, but I can't set it via command line.

I made sure there was no existing config by issuing he command make rmconfig and then testing.
 
This looks like something I could do and include my custom make.conf file for each system I deploy
If you have lots of systems to deploy why don't you make things easier by setting up your own repository? I think it's a bit of a waste of time to build everything from ports every time you deploy a new system. Just build your own repository, set your own defaults and use the resulting packages for deployment. The added benefit of your own repository is that you can be sure all your systems are deployed with the exact same set of packages, with the same set of options. You also don't leave lots of build dependencies on those systems which only take up space once the ports have been built.
 
If you have lots of systems to deploy why don't you make things easier by setting up your own repository? I think it's a bit of a waste of time to build everything from ports every time you deploy a new system. Just build your own repository, set your own defaults and use the resulting packages for deployment. The added benefit of your own repository is that you can be sure all your systems are deployed with the exact same set of packages, with the same set of options. You also don't leave lots of build dependencies on those systems which only take up space once the ports have been built.

It's not that I have a "lot" of systems to deploy, it's more that I pretty much only deploy FreeBSD now. When I do, a lot of the software/options are the same. Some important like the setting up freebsd-update in cron and some completely trivial like modifying gettytab so that the console is clean with just a login prompt. I got the idea for doing something like this from this post in the forums.

As for setting up my own repository, that's only my list of things to accomplish (at least learn). As for dealing with the build dependencies, I was opting to (as part of my script) install portmaster so I could --build-packages --delete-build-only to use and remove packages required for building (hopefully) keeping my system clean.
 
As for setting up my own repository, that's only my list of things to accomplish (at least learn). As for dealing with the build dependencies, I was opting to (as part of my script) install portmaster so I could [BGCOLOR=#dee3e7] --build-packages --delete-build-only[/BGCOLOR] to use and remove packages required for building (hopefully) keeping my system clean.

Please look at synth or poudriere if you’re looking for this functionality rather than reinventing the wheel.
 
Actually.. It may be re-inventing the wheel according to some but setting something up on your own definitely has plenty of advantages. Gaining some extra expertise for starters.

I've run my own setup for years now (basically I scripted my entire environment based on portmaster) and it even survived the recent flavor changes without too much effort (when Portmaster didn't support it yet at that time).

I would really recommend this over relying on pre-made solutions, especially if you want to learn more about the process.
 
Back
Top