From 0b5e00a20faa4789bf4f241b1147ba8f6c0a031c Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 11 Jun 2014 00:27:58 +0200 Subject: [PATCH] Automatically generate paths in the ddns script. --- .gitignore | 1 + Makefile.am | 23 ++++++++++++++++++++++- configure.ac | 1 + ddns => ddns.in | 2 +- 4 files changed, 25 insertions(+), 2 deletions(-) rename ddns => ddns.in (97%) diff --git a/.gitignore b/.gitignore index dbbef86..17f56bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /Makefile /build-aux +/ddns /missing /src/ddns/__version__.py /tmp diff --git a/Makefile.am b/Makefile.am index 66c6a15..bfa5a61 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,7 +51,13 @@ dist_doc_DATA = \ # ------------------------------------------------------------------------------ -dist_bin_SCRIPTS = \ +bin_SCRIPTS = \ + ddns + +EXTRA_DIST += \ + ddns.in + +CLEANFILES += \ ddns dist_configs_DATA = \ @@ -66,3 +72,18 @@ ddns_PYTHON = \ src/ddns/system.py ddnsdir = $(pythondir)/ddns + +# ------------------------------------------------------------------------------ + +substitutions = \ + '|PACKAGE_NAME=$(PACKAGE_NAME)|' \ + '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \ + '|configsdir=$(configsdir)|' + +SED_PROCESS = \ + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \ + $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \ + < $< > $@ + +ddns: ddns.in Makefile + $(SED_PROCESS) diff --git a/configure.ac b/configure.ac index fae19f0..de89e65 100644 --- a/configure.ac +++ b/configure.ac @@ -49,6 +49,7 @@ AC_SUBST(GETTEXT_PACKAGE) AC_PROG_LN_S AC_PROG_MKDIR_P +AC_PROG_SED # Python AM_PATH_PYTHON([2.7]) diff --git a/ddns b/ddns.in similarity index 97% rename from ddns rename to ddns.in index 66f0e04..8e96858 100644 --- a/ddns +++ b/ddns.in @@ -22,6 +22,6 @@ import ddns d = ddns.DDNSCore(debug=1) -d.load_configuration("/etc/ddns.conf") +d.load_configuration("@configsdir@/ddns.conf") d.updateall() -- 2.39.2