You are changing the fundamental nature of the application by doing this, making it no longer self-contained within a single filesystem tree.
This might be not what your users want; nor how your application is used, distributed, and installed in practice.
If your application installs self-contained from a single archive into a single filesystem sub-tree as a "portable application" install, you will break this.
If your application doco recommends this as the best way to install it, you break things for a lot of your users.
You are introducing support problems and creating support expense (from stale config files, unexpectedly shared config files, surprising events at software upgrades, and others), with no better reason than to use parts of a Linux standard that many Linux-based operating systems intentionally do not use and that does not even apply to non-Linux operating systems like MacOS that your program targets.
Be warned.
Also be warned that /etc
is not always the place that operating systems want used for this sort of thing.
It is common on the BSDs, for example, for applications to be configured to use /usr/local/etc
rather than /etc
.
Similarly, FreeDesktop.org standards prefer that applications use the directories specified by the XDG_CONFIG_HOME
and XDG_CONFIG_DIRS
environment variables.
Ironically, you are actually moving away from your application's "portable application" model, not making things more portable.
And you aren't even doing the work to keep the doco in synch.
Further reading
${dir_that_bin_is_in}/../etc/…
that will allow it to be placed in/usr/local
. Another option is to specify it in./configure
. – ctrl-alt-delor Jul 18 '20 at 17:32/etc
. What if the program is installed in/bin
or/sbin
or/usr/bin
instead of/usr/local/bin
? – terdon Jul 18 '20 at 17:36/etc
means every system the application is to be used on has to be configured. At least with a relative path, if the app is located in /path/to/app/binand the configuration is in
/path/to/app/bin/../etc, sharing
/path/to/appis sufficient to share the app on multiple systems in a way that doesn't need local configuration in
/etc` on all systems the app is to be used on. This question makes me wonder what problem moving the configuration from its current location is solving. – Andrew Henle Jul 18 '20 at 17:44/etc
is pretty standard, using that for configuration is probably the most portable solution. If you want to avoid that, just keep all the information in one directory which can be defined at install time. Then, the program will know to search in that directory. But expecting your config dir to be exactly N directories above you is bound to fail. – terdon Jul 18 '20 at 17:53