Thinkpiece: alternative config option over /etc/.../50-config.conf: Difference between revisions

From razwiki
Jump to navigation Jump to search
(Created page with "<pre> root@7c32f54356fc:/# tree /etc/apt/apt.conf.d/ /etc/apt/apt.conf.d/ |-- 01autoremove |-- 70debconf |-- 99-yes-install.conf |-- docker-autoremove-suggests |-- docker-clea...")
 
 
Line 30: Line 30:
== See also ==
== See also ==


https://unix.stackexchange.com/a/570782/124123
* https://unix.stackexchange.com/a/570782/124123

[[How to make apt install without prompt via config]]
* [[How to make apt install without prompt via config]]

Latest revision as of 17:53, 3 December 2021

root@7c32f54356fc:/# tree /etc/apt/apt.conf.d/
/etc/apt/apt.conf.d/
|-- 01autoremove
|-- 70debconf
|-- 99-yes-install.conf
|-- docker-autoremove-suggests
|-- docker-clean
|-- docker-gzip-indexes
`-- docker-no-languages

What is going on in .conf.d directories

  • packages have configuration
  • configuration lives in directories
  • directories are maps of filenames to file contents; filenames can have a priority number (99-something.conf overwrites 50-something.conf).
  • file contents are arrays of lines
  • lines are key:value pairs
  • multiple lines can contain the same config value; the later ones overwrite the earlier ones.

Basically the entire configuration, spanning the whole file system, can be reduced to a single json object. A package could force users to configure it in a single json object (and some do), but writing json by hand has ergonomic issues, and multiple packages might want to write config, and they may conflict. Who wins is undecidable from the packages' point of view, but the config should at least be consistent for a given filesystem state.

Issues

99-filename.conf looks strange, and invites potentially unnecessary user decisions on how to name their configuration options, rather than one opinionated standard. The basic problem is how to have individual array elements assert their position.

I suppose it would work fine to just say "it's alphabetical" and let files name themselves 000000-MEFIRST.conf if they really care or <some gnarly unicode character>-MELAST.conf if they care. But most config can just be something like /etc/apt/apt.conf.d/config.conf. A lot of redundancy but at least it's only communicating 2 concepts: "I am config" and "the config is for apt". I think I'll do that.

See also