Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Commit d79e5c5

Browse files
committed
Add sysconfdir to search path for config files
1 parent 4c6de19 commit d79e5c5

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ACLOCAL_AMFLAGS = -I m4
2121

2222
SUBDIRS = src po
2323

24+
pkgsysconfdir = $(sysconfdir)/@PACKAGE@
2425
libstatedir = @localstatedir@/lib/@PACKAGE@
2526

2627
dist_libstate_DATA = \

doc/motionplus_config.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2896,6 +2896,11 @@ <h2><a name="config_files"></a> The Configuration Files </h2>
28962896
by --localstatedir=DIR during the configure step of installation. If this was
28972897
not defined, it will default to /var/lib/motionplus or /usr/local/var/lib/motionplus
28982898
depending upon your system</li>
2899+
<li> The directory defined by --sysconfdir=DIR during the configure step of installation.
2900+
If this was not defined, it will default to /etc/motionplus or /usr/local/etc/motionplus
2901+
depending upon your system. Please note that the use of this directory for the configuration
2902+
files is deprecated. Some significant functionality of Motionplus will not be available
2903+
if the configuration files are in this directory.</li>
28992904
</ol>
29002905
<p></p>
29012906
The motionplus.conf file specifies parameters for the entire MotionPlus application and defaults for

src/Makefile.am

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
# */
1818

1919

20-
AM_CPPFLAGS= -Dconfigdir=\"$(localstatedir)/lib/@PACKAGE@\" -DLOCALEDIR=\"$(localedir)\"
20+
AM_CPPFLAGS= \
21+
-Dconfigdir=\"$(localstatedir)/lib/@PACKAGE@\" \
22+
-Dsysconfdir=\"$(sysconfdir)/motionplus\" \
23+
-DLOCALEDIR=\"$(localedir)\"
2124

2225
LDADD = $(LIBINTL)
2326

src/conf.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4310,6 +4310,21 @@ void cls_config::init()
43104310
}
43114311
}
43124312

4313+
if (filename == "") {
4314+
filename = std::string( sysconfdir ) + std::string("/motionplus.conf");
4315+
if (stat(filename.c_str(), &statbuf) != 0) {
4316+
filename = "";
4317+
}
4318+
if (filename != "") {
4319+
MOTPLS_LOG(WRN, TYPE_ALL, SHOW_ERRNO
4320+
,_("The configuration file location '%s' is deprecated.")
4321+
, sysconfdir );
4322+
MOTPLS_LOG(WRN, TYPE_ALL, SHOW_ERRNO
4323+
,_("The new default configuration file location is '%s'")
4324+
, configdir );
4325+
}
4326+
}
4327+
43134328
if (filename == "") {
43144329
MOTPLS_LOG(ALR, TYPE_ALL, SHOW_ERRNO
43154330
,_("Could not open configuration file"));

0 commit comments

Comments
 (0)