Working around freebsd-update’s lack of /etc merging
For a time, I could not just run freebsd-update normally, because it would just bail out with an error due to some of my local changes in /etc (namely in my case to /etc/ssh/sshd_config). The error handling has since improved, but patch-level updates still won’t merge changes to files in /etc. This meant figuring out how to work around this with a manually operated 3-way merge around freebsd-update.
Currently I no longer need this workaround; evidently, there is no longer a patch that touches that file. Since the workaround is a bit ungainly, I would like to get rid of it. However, the behavior fundamentally remains (if now with a friendlier UX), and so the workaround may again become necessary someday in future. Therefore instead of either keeping it around commented out forever or dumping it without any record, I am documenting it here for myself before removing it.
As setup it is necessary to obtain a patch containing local changes, for which the base revision can be gleaned from the etcupdate database:
diff -u \
/var/db/etcupdate/current/etc/ssh/sshd_config \
/etc/ssh/sshd_config \
> sshd_config.patch
Performing an update then consists of the following procedure:
patch -R /etc/ssh/sshd_config sshd_config.patch &&
freebsd-update fetch install &&
patch /etc/ssh/sshd_config sshd_config.patch &&
service sshd restart
Season to taste for other affected files/services.