Re: problem with files in /etc/dir.d (continued)
Filippo Rusconi <rusconi@mnhn.fr> schrieb:
> Hello,
>
> Thanks to the persons who have kindly answered my questions about the
> /etc/dir.d/ problem.
>
> At the beginning, the software did use the /usr/etc/dir.d
> configuration directory, but then the packaging system would complain
> that this is not a standard location. I used this location because
> that is simpler, using the ${prefix}-based variables from the
> autotools (that is : ${sysconfdir} will resolve to /usr/etc if
> ${prefix} is /usr).
>
> So, if it is not correct to put the stuff in /usr/etc (can someone
> help me decide if this is actually forbidden ?), I'll put the conf
> files in a /usr/share/thepackage/dir.d directory.
First check whether these files are configuration files:
,----
| 10.7 Configuration files
| 10.7.1 Definitions
|
| configuration file
| A file that affects the operation of a program, or provides site-
| or host-specific information, or otherwise customizes the behavior of
| program. Typically, configuration files are intended to be modified
| by the system administrator (if needed or desired) to conform to local
| policy or to provide more useful site-specific behavior.
`----
If it isn't, it should probably go to /usr/share. If it is a
configuration file, you have to put it somewhere under /etc and decide
whether it should be a conffile, too. If there is a reasonable default
that will make your program work und normal circumstances, and only has
to be modified occasionally, you should make it a conffile. If not, you
can use debconf or other means to create one, and then it may _not_ be a
conffile. This is usually achieved by not shipping it in /etc in the
package, but to generate it or modify a template and then copy the
resulting file to /etc in postinst.
One more remark: You used the term /etc/dir.d. There is no official
policy for this AFAIK, but usually directories like this are used in a
special way: A program called foo reads it's configuration file foo.conf
from either /etc/foo.conf or /etc/foo/foo.conf (if there are a lot of
configuration files for foo). But other packages that use foo need to
add configuration items to foo.conf. They cannot if foo.conf belongs to
the foo package (i.e. is a configuration file), and they cannot simply
add stuff if foo.conf was created by foo's postinst, because this will
be overriden upon upgrade of foo. So the solution is to
- create a directory /etc/foo.d (or /etc/foo.conf.d or
/etc/foo/foo.conf.d)
- foo itself, as well as other packages using foo place a confile in
this directory
- There is some mechanism by which foo then can get the information
stored in the conffiles in /etc/foo.d. Either it reads it directly,
like pam does, or there's a script called update-foo.conf or the like
that is called in the postinst scripts of foo and depending
packages. It creates /etc/foo.conf from the information taken from the
files in /etc/foo.d/.
I would suggest to _not_ use the name foo.d for a directory under /etc
that does _not_ use this principle.
Regards, Frank
--
Frank Küster, Biozentrum der Univ. Basel
Abt. Biophysikalische Chemie
Reply to: