Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

As far as I understand, the /etc/apt/apt.conf file of Squeeze has been broken into separate files within the /etc/apt/apt.conf.d/ directory in Wheezy.

The debian wiki has not been updated yet and it seems to contain info only about /etc/apt/apt.conf.d/70debconf.

In any case, I am not entirely familiar with configuring apt, besides merely editing /etc/apt/sources.list and I am kinda lost here. The directory structure on my machine is:

/etc/apt/apt.conf.d/
  00aptitude
  00CDMountPoint
  00trustcdrom
  01autoremove
  20listchanges
  20packagekit
  70debconf

and my questions are:

  1. What do these files do?
  2. What do the numbers mean?
  3. Can I add new files to this dir so that they are loaded as well? If so, is there a convention for doing so?
share|improve this question
    
The Debian wiki has this note: "ToDo: /etc/apt/conf file no longer exists (at least in testing), the configuration is now modular and the topic should be extended specifically we are talking here about /etc/apt/apt.conf.d/70debconf file" so I guess they do the same thing that apt.conf did, just split into separate files. In a similar way as /etc/apt/sources.list.d or /etc/X11/xorg.conf.d. –  terdon Nov 14 '13 at 13:27

2 Answers 2

up vote 4 down vote accepted

Quoting The Debian Administrator's Handbook

... it is possible to configure certain aspects of APT by adding directives in a file of the /etc/apt/apt.conf.d/ directory.

and a little further down:

... all of the files in /etc/apt/apt.conf.d/ are instructions for the configuration of APT. APT includes them in alphabetical order, so that the last ones can modify a configuration element defined in one of the first ones.

share|improve this answer

This is a typical .d configuration directory. These directories replace or extend a configuration file so that you or a package maintainer can modify the configuration of a program without having to edit a central configuration file.

It's useful because it splits a configuration file into smaller, more manageable chunks which in turn makes it easier for packages to extend the configuration of programs. For example, imagine that you're a package maintainer, and your package has to extend /etc/apt/apt.conf with some configuration directives. Now you have to worry about changes the user or other packages may have made to this file - you must be careful not to overwrite or break these changes, and in turn you have to expect that other changes may break your directives.

.d directories make this much easier. You just put your directives into a file /etc/apt/apt.conf.d/20my-package-name.conf, and you're mostly done.

What do these files do?

Each file adds it's own configuration directives to the apt configuration. You'll have to look into each file if you want to know what it does exactly.

What do the numbers mean?

The files are read in alphabetical order, so you can prepend numbers to the file name if you prefer them to be read in a specific order. For example, if later directives overwrite earlier ones (that of course depends on the respective program that reads those files), you could use a low number like 00 to supply default values, a number in the middle like 20 or 40 for normal directives, and a high number like 90 to supply important directives that must overwrite all earlier directives.

Can I add new files to this dir so that they are loaded as well?

Yes, that's the idea of it.

If so, is there a convention for doing so?

Depends on the program, but essentially it's just

  • use a unique name
  • if there's an ordering system, choose a sensible number
  • some programs only read files with a specific extension, so look at the other files to determine the correct extension
  • be careful not to leave any junk files in the directory (for example old backups or temporary files), because those may break the application if it includes every single file in the directory
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.