0

In Makefile.am we have:

bin_PROGRAMS = sample
sample_SOURCES = main.cpp
sampleconfdir = $(sysconfdir)/sample
sampleconf_DATA = sample.cfg

whenever I install the application using make install, the file sample.cfg gets overwritten. How to tell automake to skip copy if file is already present?

0

1 Answer 1

0

It is fairly common for software to install example configurations and let the user copy and modify this configuration for use with their actual installation. By "user" I mean anyone installing the software, be it a local administrator (root) installing the software system-wide or an unprivileged user installing the software under their $HOME somewhere.

Example configuration files may, for example, be installed

  1. in or under sysconfdir, but with a modified filename (for example with a .example suffix).
  2. is a separate examples directory somewhere under docdir.

The INSTALL document would then direct the user to copy and modify these examples to suit their needs.

The benefit of this is that the user installing a new version of the software would get an up to date example of the configuration file or files. They can then update their actual configuration based on the new files if they need to do so.

Avoiding installing a new configuration file, and not installing examples, would possibly leave the user in a bewildered state when the syntax of the configuration, or any of its settings, has changed as they don't know what the file should look like (unless this is clearly mentioned in the utility's manual and upgrade instructions).

2
  • In my case, sample.cfg is a configuration file that should only be changed by super users. So, letting user take a copy and do whatever, is not applicable. Am I correct? Feb 3, 2019 at 8:54
  • @Ali The "user" may well be a local administrator (someone with root authority), so what I wrote still applies.
    – Kusalananda
    Feb 3, 2019 at 9:00

You must log in to answer this question.

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