[hatari-devel] Default configuration file

Thomas Huth huth at users.berlios.de
Sun Jun 19 19:41:57 CEST 2011


Am Sat, 11 Jun 2011 19:59:38 +0300
schrieb Eero Tamminen <eerot at users.berlios.de>:

> Hi,
> 
> On lauantai 11 kesäkuu 2011, Christer Solskogen wrote:
> > I don't know if this it intentional or not, but I noticed this when
> > I installed hatari on a new machine:
> > Configuration file /etc/hatari.cfg not found.
> > 
> > I think it's a bit odd that it looks for hatari.cfg in /etc, when I
> > installed hatari in /usr/local (I did not specify a prefix)
> > - The question is if it really looks for a configuration file
> > in /etc or that it just say it does,
> 
> That's what the CMakeLists.txt seems to unconditionally set,
> regardless of prefix:
> ---
> add_definitions(-DCONFDIR=\"/etc\")
> ---
> 
> It's a regression from Hatari v1.4.  Thomas, could you look at it?

Right, it's a small regression compared to the behaviour of the old
automake configuration script.

> As Hatari itself doesn't install any cfg file, it's not a problem for
> file installs, just locating the global config file.

... so the question is whether the position of the _global_
configuration file should be configurable, too, or whether global
configuration files should always got to /etc ... ?

The right location of the etc directory seems to be a mess, according
to the Linux Filesystem Hierarchy Standard, there's also /etc/opt for
software that is installed into /opt, and /etc/local for software that
is installed into /usr/local ...

> > but what it really do is to search for in in $prefix/etc.
> 
> It's a bit more complicated.  If $prefix is empty, prefix should
> default to /usr.  If prefix is /usr, conf should be in /etc.  Only
> when prefix isn't /usr, conf should be in $prefix/etc. (And that's
> only Linux/Unix...)

And you have to take into account that Hatari is a relocatable package,
so you can specify prefix=/usr/local during build-time, for example,
but when you install the package later, it can also go to /opt/hatari
instead! (That's why we have the BIN2DATADIR stuff in the sources).

So when you say that putting the global configuration file into /etc
only is not enough, you've got to add some code that determines the
prefix at runtime, then checks whether it's in /usr, /usr/local, /opt
or somewhere else, and then either uses /etc, /usr/local/etc (or
/etc/local), /etc/opt or $prefix/etc as configuration directory.

Quite a mess for a global configuration file that we do not use at all
in most cases, isn't it? And I think implementing the above search
algorithm would rather confuse the users, too, instead of helping them.
So IMHO the current behaviour is good enough already, /etc is a well
known location for global configuration files, and there is of course
always the possibility to add a configuration file in the ~/.hatari/
home directory, too.

It's just a little bit ugly that Hatari spills out the "Configuration
file xy not found" message each time you start the emulator. Maybe we
should change that to a debug log message instead?

 Thomas



More information about the hatari-devel mailing list