Page MenuHomeFreeBSD

Add automated (non interactive) mode to etcupdate
AbandonedPublic

Authored by kmoore on Jun 6 2018, 3:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 7:28 PM
Unknown Object (File)
Fri, Mar 29, 5:12 AM
Unknown Object (File)
Mon, Mar 25, 8:56 AM
Unknown Object (File)
Feb 27 2024, 1:28 AM
Unknown Object (File)
Dec 20 2023, 7:26 AM
Unknown Object (File)
Nov 7 2023, 8:09 PM
Unknown Object (File)
Nov 5 2023, 6:16 PM
Unknown Object (File)
Oct 6 2023, 7:02 PM
Subscribers

Details

Reviewers
jhb
bcr
Group Reviewers
manpages
Summary

As apart of us using etcupdate in TrueOS with package base, we needed to add support for running etcupdate non-interactively. This new -a flag just defaults to keeping the old file in /etc when a conflict cannot be properly merged. In our use-case the user would then re-run etcupdate at some later point without the -a flag to deal with the conflicts by hand.

Test Plan

We're already using this in production in TrueOS, so far so good.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 17041

Event Timeline

bcr added a subscriber: bcr.

OK from manpages, if you bump the .Dd upon commit.

This revision is now accepted and ready to land.Jun 6 2018, 3:35 PM

Just bumped the date on .Dd, thanks @bcr

This revision now requires review to proceed.Jun 6 2018, 5:01 PM

So I would perhaps try to make this more flexible and to more closely match the svn syntax (this is akin to 'svn resolve --accept working') by supporting 'etcupdate -a <mode>' where 'mode' is one of the prompt options (but not 'p', just 'mf' or 'tf' and possibly the 'mine-full' and 'theirs-full' aliases). In that case I would probably call the variable "resolve_mode" or some such (automated means different things to different people and I think it is too ambiguous to use here).

Also, as implemented this only affects 'etcupdate resolve' but not 'etcupdate' (the default command). The manpage and usage are incorrect, but I actually think it would be more useful to be able to specify this option for the default command, but that means changing the logic in merge_file() to consult the 'resolve_mode' and only call new_conflict if it does not specify a valid mode. (This means you could also specify 'resolve_mode=mf' in /etc/etcupdate.conf to change the default without having to alter the command line invocation for TrueOS if you wished and not having to call 'etcupdate resolve', just 'etcupdate' itself.)

Finally, there are some existing tests for etcupdate that test conflicts. It would be good to extend those to test that the new conflict modes work as well.

Also, one thing that may not be clear from the commit log: etcupdate already doesn't prompt for the "default" command. It is only "etcupdate resolve" that prompts the user. If you are currently only using '-a' with 'etcupdate' currently then this change isn't actually doing anything as it only changes the behavior of 'etcupdate resolve'. (One reason one might want a default resolve action though is that 'etcupdate' refuses to perform an update if there are previously-unresolved conflicts from an earlier run.)

I'm going to close this for now. With the incoming changes to package base this may become unnecessary moving forward. We'll maintain the local patch in TrueOS for the time being until we drop it there also.