As my environment grows, I'm automating more and more of my work (package installation, config file propagation, etc.) so I can keep up with it. The problem I'm running into with my OpenBSD boxes is with services/daemons.
When my scripts install a package, they have to edit the monolithic /etc/rc.local in order to enable starting (rc.conf.local too, but that's a single line easily done with sed and checked with grep). Uninstalling a package is scarier since they're removing the parts of /etc/rc.local. Both of these rely on multi-line pattern matching and merging, which are imperfect sciences that wrack my nerves when they run automatically. The much larger problem, though, is with starting/stopping/restarting services. Say I add spamd as an enabled service on host1. For my scripts to start it properly, I have to replicate the code already in /etc/rc defining how spamd starts. This is prone to errors and runs the risk of breaking on upgrades. Restarting services that need more than a HUP is also a chore. As for stopping, some services like postgresql need some careful attention. This means replicating code from /etc/rc.shutdown. I've looked at adding some stupid delimiters to /etc/rc, /etc/rc.local, and /etc/rc.shutdown so I can just pull in the necessary chunks, but I'm wondering if there's anything available that's more elegant and won't break on every upgrade. Has anyone solved this problem on OpenBSD? -HKS