0

I used to see lots of /etc/<something>.conf files used to configure the system, making it clear via the <something> what is to be configured (I would call this "config files").

This trusted and imho working system seems however not to be sufficient, as more and more I encounter what I would name "config directories" which I often perceive to be structrured like:

/etc/<something>.conf/ 
|-<file1>
|-<file2>
|-<file3>

creating a situation where the settings in the single files (<file1>, <file2>, <file3>) where all the containing files are (in my perception) merelye concantenated before being used like the "config file" before.

Since it cannot be merely that people felt the urge to reinvent the wheel, just so it was "invented here", there must be a reason for resorting to "config directories".

I wonder hence, what is the use-case of "config directories", that made them necessary in the first place?

Are there some core essential things, that modivate to use a config directory over a plain config file?

Example

1 Answer 1

2

If your distro has a package management system, and different packages may need to add to different parts of the configuration, then it's a lot easier to just put a new file a new configuration directory instead of changing some part in a configuration file.

Note that it is easier to do it with directories, not that the other way is impossible. In the past, package installation scripts had to change single configuration files, and people got fed up with it.

5
  • Exactly; I’d add that many distributions explicitly forbid packages modifying each others’ configuration files, leaving configuration directories as the only option for multiple packages to contribute configuration “pieces”. Sep 25, 2018 at 13:07
  • First encouters with directories, in place of simple config files left me puzzled how the respective software will treat the contained information. Is there some sort of convention how the directories are treated (i.e. that all its contained files are concatenated in their LANG=C order of occurence)? Sep 25, 2018 at 13:14
  • I guess the most-used convention is that they are (effectively, the program may just read in each file in turn) concatenated in some order that at least respects digits, so you can start file names with digits if order is important. But I haven't seen any "official" policies, though distros may have them.
    – dirkt
    Sep 25, 2018 at 13:23
  • 1
    That should be a real question, because some softwares do document the conventions to be followed and answer comments are really not the place for discussing them.
    – JdeBP
    Sep 25, 2018 at 13:42
  • they usually start with numbers zero padded to some width (eg. 01-foo.conf, 10-bar.conf) so that the numeric order is the same as the lexicographical order (which is the default order used by globbing, ls, sort, etc).
    – user313992
    Sep 25, 2018 at 15:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .