Automatically generate paths in the ddns script.
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 10 Jun 2014 22:27:58 +0000 (00:27 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 10 Jun 2014 22:27:58 +0000 (00:27 +0200)
.gitignore
Makefile.am
configure.ac
ddns.in [moved from ddns with 97% similarity]

index dbbef86..17f56bd 100644 (file)
@@ -1,5 +1,6 @@
 /Makefile
 /build-aux
+/ddns
 /missing
 /src/ddns/__version__.py
 /tmp
index 66c6a15..bfa5a61 100644 (file)
@@ -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)
index fae19f0..de89e65 100644 (file)
@@ -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 (file)
--- 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()