[Tutor] where to put configuration files

Sean 'Shaleh' Perry shalehperry@attbi.com
Sun Jun 8 14:56:21 2003


> >
> > If you *EVER* intend this to be real software used by real users, yes
> > /etc is the place to go.  It is probably a good idea to create a subdir
> > and place the config in there.  Something like /etc/mypackage/foo.conf.
>
> R. Alan Monroe wrote me off this mailing list and pointed out that
> Windows users have no /etc/ directory. Mac OS X users do.
>

since you referred to /etc I assumed (yes I know ...) you were only referring 
to a Unix like operating system.

If you truly want to be portable here we go .....

a) easy case, store all of the program in one base dir as suggested.  Expected 
behavior on Windows and I believe OS X.

b) however, this is the WRONG behavior under a Unix like OS.  /usr is often 
mounted read-only so your config once written could never be changed.  It 
also prevents people from packaging the software and integrating it with the 
rest of the OS (say for instance Debian, RedHat, NetBSD).

Therefore as Kirk mentions the best situation is to have the location of th 
config defined as a variable and allow the installation procedure to indicate 
where the config ends up.

Note this same discussion is relevant for logs, data and just about anything 
else you write.

** for the purists out there, let me settle the pedantic issues screaming in 
your head.

Yes, old school Unix used to dump a program in /usr/lib/app.  As noted above 
this prevents /usr being mounted read-only and also prevents proper 
utilization of things like network mounted directories.  A modern approach to 
this is to have a /opt hierarchy and each directory in /opt is like a 
installation directory in OS X or Windows.  Just drop the whole thing there 
and everything works.  However not everyone likes /opt or supports it fully 
(the Linux Standards Base will slowly get the Linux community to support it 
though).

If you like the all in one place philosophy or the spread out philosophy the 
above suggestion allows for either.

Now that I have put everyone to sleep, back to your regularly scheduled 
emails.