From 2528c4c9d693d16d2b57582e008e3e59e1f537af Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 25 Nov 2015 21:53:29 +0000 Subject: [PATCH] make binary exec path dynamic in scripts referring to it Everything should just work out of the box without poking. This change makes that goal to be yet agian one step closer. In same go make all autotools related variable substitutions better. Requested-by: Martijn van Brummelen Signed-off-by: Sami Kerola --- Makefile.am | 28 ++++++++++++++++++- configure.ac | 4 +-- contrib/.gitignore | 2 ++ contrib/Makemodule.am | 4 ++- .../{dhcpd-pools.cgi => dhcpd-pools.cgi.in} | 4 +-- contrib/nagios.conf | 1 - contrib/nagios.conf.in | 1 + doc/.gitignore | 1 + doc/Makemodule.am | 6 +++- doc/doxy.conf.in | 2 +- man/Makemodule.am | 3 +- man/dhcpd-pools.1.in | 2 +- 12 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 contrib/.gitignore rename contrib/{dhcpd-pools.cgi => dhcpd-pools.cgi.in} (91%) delete mode 100644 contrib/nagios.conf create mode 100644 contrib/nagios.conf.in create mode 100644 doc/.gitignore diff --git a/Makefile.am b/Makefile.am index b2beaca..0daa8bf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,9 +16,35 @@ $(top_srcdir)/.version: dist-hook: echo $(VERSION) > $(distdir)/.tarball-version -CLEANFILES = +PATHFILES = +CLEANFILES = $(PATHFILES) +EXTRA_DIST += $(PATHFILES:=.in) CLEAN_LOCALS = +edit_cmd = sed \ + -e 's|@ALARM_CRIT[@]|$(ALARM_CRIT)|g' \ + -e 's|@ALARM_WARN[@]|$(ALARM_WARN)|g' \ + -e 's|@DHCPDCONF_FILE[@]|$(DHCPDCONF_FILE)|g' \ + -e 's|@DHCPDLEASE_FILE[@]|$(DHCPDLEASE_FILE)|g' \ + -e 's|@OUTPUT_FORMAT[@]|$(OUTPUT_FORMAT)|g' \ + -e 's|@OUTPUT_LIMIT[@]|$(OUTPUT_LIMIT)|g' \ + -e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \ + -e 's|@PACKAGE_MAINTAINER[@]|$(PACKAGE_MAINTAINER)|g' \ + -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \ + -e 's|@PACKAGE_URL[@]|$(PACKAGE_URL)|g' \ + -e 's|@SHELL[@]|$(SHELL)|g' \ + -e 's|@VERSION[@]|$(VERSION)|g' \ + -e 's|@bindir[@]|$(bindir)|g' \ + -e 's|@top_srcdir[@]|$(top_srcdir)|g' + +$(PATHFILES): Makefile + @ rm -f $@ $@.tmp + $(AM_V_at) test -d $(dir $@) || mkdir -p $(dir $@) + $(AM_V_GEN) srcdir=''; \ + test -f ./$@.in || srcdir=$(srcdir)/; \ + $(edit_cmd) $${srcdir}$@.in >$@.tmp + @ mv $@.tmp $@ + include contrib/Makemodule.am include doc/Makemodule.am include man/Makemodule.am diff --git a/configure.ac b/configure.ac index cfa9271..ec993c7 100644 --- a/configure.ac +++ b/configure.ac @@ -134,8 +134,7 @@ AM_CONDITIONAL([ENABLE_DOXYGEN], [test "x$enable_doxygen" = "xyes"]) AS_IF([test x$enable_doxygen = xyes], [ AC_CHECK_PROGS([DOXYGEN], [doxygen]) AS_IF([test "x$DOXYGEN" = "x"], - AC_MSG_ERROR([doxygen not in path]), - AC_CONFIG_FILES([doc/doxy.conf]) + AC_MSG_ERROR([doxygen not in path]) ) AC_CHECK_PROGS([DOXYGEN_DOT], [dot]) @@ -149,7 +148,6 @@ AM_CONDITIONAL([HAVE_DOXYGEN_DOT], [test "x$DOXYGEN_DOT" != "x"]) AC_CONFIG_FILES([ Makefile lib/Makefile - man/dhcpd-pools.1 ]) AC_OUTPUT diff --git a/contrib/.gitignore b/contrib/.gitignore new file mode 100644 index 0000000..591c7bd --- /dev/null +++ b/contrib/.gitignore @@ -0,0 +1,2 @@ +/dhcpd-pools.cgi +/nagios.conf diff --git a/contrib/Makemodule.am b/contrib/Makemodule.am index f6aee1f..a6bbc1e 100644 --- a/contrib/Makemodule.am +++ b/contrib/Makemodule.am @@ -1,3 +1,5 @@ contribdir = $(datadir)/dhcpd-pools/ +PATHFILES += contrib/dhcpd-pools.cgi contrib/nagios.conf dist_contrib_SCRIPTS = contrib/dhcpd-pools.cgi contrib/snmptest.pl -EXTRA_DIST += contrib/nagios.conf contrib/munin_plugins +dist_contrib_DATA = contrib/nagios.conf +EXTRA_DIST += contrib/munin_plugins diff --git a/contrib/dhcpd-pools.cgi b/contrib/dhcpd-pools.cgi.in similarity index 91% rename from contrib/dhcpd-pools.cgi rename to contrib/dhcpd-pools.cgi.in index 15a73fb..117a7cf 100755 --- a/contrib/dhcpd-pools.cgi +++ b/contrib/dhcpd-pools.cgi.in @@ -1,4 +1,4 @@ -#!/bin/sh +#!@SHELL@ # # Simple CGI for dhcpd-pools. @@ -26,7 +26,7 @@ echo "

This was situation at " date echo "

" -/usr/local/bin/dhcpd-pools --format html +@bindir@/dhcpd-pools --format html echo "" echo "" diff --git a/contrib/nagios.conf b/contrib/nagios.conf deleted file mode 100644 index 0159fca..0000000 --- a/contrib/nagios.conf +++ /dev/null @@ -1 +0,0 @@ -command[check_dhcpd_pools]=/usr/bin/dhcpd-pools --warning $ARG1$ --critical $ARG2$ diff --git a/contrib/nagios.conf.in b/contrib/nagios.conf.in new file mode 100644 index 0000000..1881c1a --- /dev/null +++ b/contrib/nagios.conf.in @@ -0,0 +1 @@ +command[check_dhcpd_pools]=@bindir@/dhcpd-pools --warning $ARG1$ --critical $ARG2$ diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 0000000..2063aaa --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1 @@ +/doxy.conf diff --git a/doc/Makemodule.am b/doc/Makemodule.am index 5a5686d..8069c66 100644 --- a/doc/Makemodule.am +++ b/doc/Makemodule.am @@ -1,5 +1,9 @@ +PATHFILES += \ + doc/doxy.conf +nodist_noinst_DATA = \ + doc/doxy.conf + EXTRA_DIST += \ - doc/doxy.conf.in \ doc/introduction.dox if ENABLE_DOXYGEN diff --git a/doc/doxy.conf.in b/doc/doxy.conf.in index 86e2d3b..0427f34 100644 --- a/doc/doxy.conf.in +++ b/doc/doxy.conf.in @@ -32,7 +32,7 @@ PROJECT_NAME = @PACKAGE_NAME@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = @PACKAGE_VERSION@ +PROJECT_NUMBER = @VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer diff --git a/man/Makemodule.am b/man/Makemodule.am index 102705a..75f7eb1 100644 --- a/man/Makemodule.am +++ b/man/Makemodule.am @@ -1,3 +1,2 @@ man_MANS = man/dhcpd-pools.1 -EXTRA_DIST += man/dhcpd-pools.1.in -CLEANFILES += man/dhcpd-pools.1 +PATHFILES += man/dhcpd-pools.1 diff --git a/man/dhcpd-pools.1.in b/man/dhcpd-pools.1.in index a054a5f..fcd2fdb 100644 --- a/man/dhcpd-pools.1.in +++ b/man/dhcpd-pools.1.in @@ -1,4 +1,4 @@ -.TH DHCPD-POOLS "1" "2015-09-04" "@PACKAGE_STRING@" "User Commands" +.TH DHCPD-POOLS "1" "2015-09-04" "@VERSION@" "User Commands" .SH NAME dhcpd-pools \- ISC dhcpd pools usage analysis .SH SYNOPSIS