From 7248341ad621024a972415f91abea218da784aba Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 4 Jan 2025 21:08:45 -0500 Subject: [PATCH] Change default location of `ddclient.conf` to `${sysconfdir}/ddclient` --- ChangeLog.md | 25 +++++++++++++++++++++++++ Makefile.am | 4 ++-- README.md | 2 +- configure.ac | 12 ++++++++++++ ddclient.in | 2 +- 5 files changed, 41 insertions(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index a8135ad..41ca7e8 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -5,6 +5,31 @@ repository history](https://github.com/ddclient/ddclient/commits/main). ## v4.0.0-rc.2 (unreleased work-in-progress) +### Breaking changes + + * ddclient now looks for `ddclient.conf` in `${sysconfdir}/ddclient` by + default instead of `${sysconfdir}`. + [#789](https://github.com/ddclient/ddclient/pull/789) + + To retain the previous behavior, pass `'--with-confdir=${sysconfdir}'` to + `configure`. For example: + + ```shell + # Before v4.0.0: + ./configure --sysconfdir=/etc + # Equivalent with v4.0.0 and later (the single quotes are intentional): + ./configure --sysconfdir=/etc --with-confdir='${sysconfdir}' + ``` + + or: + + ```shell + # Before v4.0.0: + ./configure --sysconfdir=/etc/ddclient + # Equivalent with v4.0.0 and later: + ./configure --sysconfdir=/etc + ``` + ### New features * New `--mail-from` option to control the "From:" header of email messages. diff --git a/Makefile.am b/Makefile.am index d9baa98..3be50d6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,8 +28,8 @@ $(subst_files): Makefile -e 's|@PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \ -e '1 s|^#\!.*perl$$|#\!$(PERL)|g' \ -e 's|@localstatedir[@]|$(localstatedir)|g' \ + -e 's|@confdir[@]|$(confdir)|g' \ -e 's|@runstatedir[@]|$(runstatedir)|g' \ - -e 's|@sysconfdir[@]|$(sysconfdir)|g' \ -e 's|@CURL[@]|$(CURL)|g' \ "$${in}" >'$@'.tmp && \ { ! test -x "$${in}" || chmod +x '$@'.tmp; } @@ -40,7 +40,7 @@ ddclient.conf: $(srcdir)/ddclient.conf.in bin_SCRIPTS = ddclient -sysconf_DATA = ddclient.conf +conf_DATA = ddclient.conf install-data-local: $(MKDIR_P) '$(DESTDIR)$(localstatedir)'/cache/ddclient diff --git a/README.md b/README.md index 22db499..7eef76e 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ operating system. See the image to the right for a list of distributions with a ```shell ./configure \ --prefix=/usr \ - --sysconfdir=/etc/ddclient \ + --sysconfdir=/etc \ --localstatedir=/var make make VERBOSE=1 check diff --git a/configure.ac b/configure.ac index 827f8b7..49daf65 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,18 @@ AC_REQUIRE_AUX_FILE([tap-driver.sh]) AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign subdir-objects parallel-tests]) AM_SILENT_RULES +m4_define([CONFDIR_DEFAULT], [${sysconfdir}/AC_PACKAGE_NAME]) +AC_ARG_WITH( + [confdir], + [AS_HELP_STRING( + [--with-confdir=DIR], + m4_expand([[look for ddclient.conf in DIR @<:@default: ]CONFDIR_DEFAULT[@:>@]]))], + [], + # The single quotes are intentional; see: + # https://www.gnu.org/software/automake/manual/html_node/Uniform.html + [with_confdir='CONFDIR_DEFAULT']) +AC_SUBST([confdir], [${with_confdir}]) + AC_PROG_MKDIR_P # The Fedora Docker image doesn't come with the 'findutils' package. diff --git a/ddclient.in b/ddclient.in index ebd0e71..12c3094 100755 --- a/ddclient.in +++ b/ddclient.in @@ -132,7 +132,7 @@ sub subst_var { return $subst; } -my $etc = subst_var('@sysconfdir@', '/etc/ddclient'); +my $etc = subst_var('@confdir@', '/etc/ddclient'); my $cachedir = subst_var('@localstatedir@', '/var') . '/cache/ddclient'; our @curl = (subst_var('@CURL@', 'curl'));