From: <d_p...@us...> - 2010-01-14 16:16:41
|
Revision: 2224 http://ganglia.svn.sourceforge.net/ganglia/?rev=2224&view=rev Author: d_pocock Date: 2010-01-14 16:16:26 +0000 (Thu, 14 Jan 2010) Log Message: ----------- Configuration files and scripts are now created during the install phase rather than during configure. This allows values such as @sysconfdir@ to be used in the template configuration files. Modified Paths: -------------- trunk/monitor-core/Makefile.am trunk/monitor-core/configure.in trunk/monitor-core/contrib/ganglia_gmond.xml.in trunk/monitor-core/gmetad/Makefile.am trunk/monitor-core/gmond/Makefile.am trunk/monitor-core/gmond/gmond.solaris.init.in trunk/monitor-core/gmond/modules/python/Makefile.am trunk/monitor-core/gmond/modules/python/README.in trunk/monitor-core/web/Makefile.am Added Paths: ----------- trunk/monitor-core/scripts/fixconfig.in Modified: trunk/monitor-core/Makefile.am =================================================================== --- trunk/monitor-core/Makefile.am 2010-01-13 19:05:29 UTC (rev 2223) +++ trunk/monitor-core/Makefile.am 2010-01-14 16:16:26 UTC (rev 2224) @@ -1,12 +1,15 @@ # $Id$ # + +include $(top_srcdir)/ganglia.inc + if BUILD_GMETAD -GMETAD_SUBDIR = gmetad +GMETAD_SUBDIR = gmetad web else GMETAD_SUBDIR = endif -EXTRA_SUBDIRS = "web gmetad-python contrib" +EXTRA_SUBDIRS = "gmetad-python contrib" EXTRA_DIST_FILES = INCLUDES = @APR_INCLUDES@ @@ -16,7 +19,7 @@ SUBDIRS = $(GANGLIA_SUBDIRS) # Make sure that no matter the setting for --with-gmetad # that the gmetad directory gets distributed -GANGLIA_SUBDIRS_DIST = lib libmetrics tests gmetad gmond gstat gmetric include +GANGLIA_SUBDIRS_DIST = lib libmetrics tests gmetad web gmond gstat gmetric include DIST_SUBDIRS = $(GANGLIA_SUBDIRS_DIST) EXTRA_DIST = README.WIN README.AIX ganglia.spec.aix ganglia.spec ganglia.pod ganglia.html mans $(EXTRA_DIST_FILES) @@ -65,4 +68,26 @@ touch $(distdir)/Makefile.am find $(distdir) -exec touch -r $(distdir)/Makefile.am {} \; -bin_SCRIPTS = ganglia-config +# _SCRIPTS causes the target to be built at build time +# we want it done at install time +#bin_SCRIPTS = ganglia-config + +ganglia-config: ganglia-config.in $(FIXCONFIG) + $(FIXCONFIG) ganglia-config.in + +install-exec-hook: ganglia-config + mkdir -p $(DESTDIR)$(bindir) && \ + $(INSTALL_SCRIPT) ganglia-config $(DESTDIR)$(bindir)/ganglia-config + +contrib/ganglia_gmond.xml: contrib/ganglia_gmond.xml.in $(FIXCONFIG) + $(FIXCONFIG) contrib/ganglia_gmond.xml.in + +solaris/pkginfo: solaris/pkginfo.in $(FIXCONFIG) + $(FIXCONFIG) solaris/pkginfo.in + +# Notice that some files declared in this hook never get installed anywhere +# We use the hook to force the files to be generated, but they remain +# within the build tree for someone to inspect or manually copy to +# the desired location if needed +install-data-hook: contrib/ganglia_gmond.xml solaris/pkginfo + Modified: trunk/monitor-core/configure.in =================================================================== --- trunk/monitor-core/configure.in 2010-01-13 19:05:29 UTC (rev 2223) +++ trunk/monitor-core/configure.in 2010-01-14 16:16:26 UTC (rev 2224) @@ -742,9 +742,9 @@ ;; esac +AC_CONFIG_FILES([scripts/fixconfig], [chmod +x scripts/fixconfig]) + AC_OUTPUT(Makefile - ganglia-config - contrib/ganglia_gmond.xml tests/Makefile ganglia.spec gmetad/Makefile @@ -752,33 +752,27 @@ lib/Makefile gmond/Makefile gstat/Makefile - gmond/gmond.solaris.init gmond/modules/Makefile - gmond/modules/conf.d/modpython.conf gmond/modules/example/Makefile gmond/modules/cpu/Makefile gmond/modules/disk/Makefile gmond/modules/memory/Makefile gmond/modules/network/Makefile gmond/modules/python/Makefile - gmond/modules/python/README gmond/modules/status/Makefile gmond/modules/system/Makefile gmond/python_modules/Makefile gmond/python_modules/disk/Makefile gmond/python_modules/example/Makefile gmond/python_modules/network/Makefile - gmetad/gmetad.conf gmetad/conf.c gmetad-python/setup.py gmetad-python/Gmetad/gmetad_config.py gmetad-python/gmetad-python.conf gmetad-python/plugins/rrd_plugin.py gmetric/Makefile - include/Makefile - solaris/pkginfo - web/conf.php - web/version.php) + include/Makefile + web/Makefile) echo "" echo "Welcome to.." Modified: trunk/monitor-core/contrib/ganglia_gmond.xml.in =================================================================== --- trunk/monitor-core/contrib/ganglia_gmond.xml.in 2010-01-13 19:05:29 UTC (rev 2223) +++ trunk/monitor-core/contrib/ganglia_gmond.xml.in 2010-01-14 16:16:26 UTC (rev 2224) @@ -10,10 +10,10 @@ <service_fmri value='svc:/network/physical:default'/> </dependency> <dependency name='config' grouping='require_all' restart_on='none' type='path'> - <service_fmri value='file://localhost@prefix@/etc/gmond.conf'/> + <service_fmri value='file://localhost@sysconfdir@/gmond.conf'/> </dependency> - <exec_method name='start' type='method' exec='@prefix@/sbin/gmond' timeout_seconds='60'/> + <exec_method name='start' type='method' exec='@sbindir@/gmond' timeout_seconds='60'/> <exec_method name='stop' type='method' exec=':kill' timeout_seconds='60' /> <instance name="default" enabled="true"> Modified: trunk/monitor-core/gmetad/Makefile.am =================================================================== --- trunk/monitor-core/gmetad/Makefile.am 2010-01-13 19:05:29 UTC (rev 2223) +++ trunk/monitor-core/gmetad/Makefile.am 2010-01-14 16:16:26 UTC (rev 2224) @@ -1,3 +1,6 @@ + +include $(top_srcdir)/ganglia.inc + if STATIC_BUILD GCFLAGS = -D_LARGEFILE64_SOURCE GLDADD = @@ -20,7 +23,7 @@ gmetad_LDFLAGS = $(GLDFLAGS) -EXTRA_DIST = gmetad.aix.init gmetad.conf gmetad.init gmetad.init.SuSE \ +EXTRA_DIST = gmetad.aix.init gmetad.conf.in gmetad.init gmetad.init.SuSE \ type_hash.gperf xml_hash.gperf gmetad-default xml_hash.c: xml_hash.gperf @@ -28,3 +31,11 @@ type_hash.c: type_hash.gperf gperf -G -l -H type_hash -t -F ', 0' -N in_type_list -k '1,$$' -W types type_hash.gperf > type_hash.c + +gmetad.conf: gmetad.conf.in $(FIXCONFIG) + $(FIXCONFIG) gmetad.conf.in + +install-data-hook: gmetad.conf + mkdir -p $(DESTDIR)$(sysconfdir) && \ + $(INSTALL_DATA) gmetad.conf $(DESTDIR)$(sysconfdir)/gmetad.conf + Modified: trunk/monitor-core/gmond/Makefile.am =================================================================== --- trunk/monitor-core/gmond/Makefile.am 2010-01-13 19:05:29 UTC (rev 2223) +++ trunk/monitor-core/gmond/Makefile.am 2010-01-14 16:16:26 UTC (rev 2224) @@ -1,3 +1,6 @@ + +include $(top_srcdir)/ganglia.inc + SUBDIRS = modules python_modules EXTRA_DIST = gmond.aix.init gmond.init gmond.init.SuSE gmond.conf.5 gmond.conf.html conf.pod @@ -48,3 +51,15 @@ gmond_DEPENDENCIES = $(gmond_LDADD) gmond_LDFLAGS = $(GLDFLAGS) + +gmond.solaris.init: gmond.solaris.init.in $(FIXCONFIG) + $(FIXCONFIG) gmond.solaris.init.in + +# we declare the hook so that gmond.solaris.init will be created within the +# build tree during the install phase +# however, the action to install it is commented out, as it is likely +# the SA will use some other script to put this file into a package or +# something +install-exec-hook: gmond.solaris.init +# $(INSTALL_SCRIPT) gmond.solaris.init + Modified: trunk/monitor-core/gmond/gmond.solaris.init.in =================================================================== --- trunk/monitor-core/gmond/gmond.solaris.init.in 2010-01-13 19:05:29 UTC (rev 2223) +++ trunk/monitor-core/gmond/gmond.solaris.init.in 2010-01-14 16:16:26 UTC (rev 2224) @@ -1,7 +1,7 @@ #!/bin/sh GANGLIA_BASEDIR=@prefix@ -GMOND=${GANGLIA_BASEDIR}/sbin/gmond +GMOND=@sbindir@/gmond test -f /etc/default/gmond && . /etc/default/gmond Modified: trunk/monitor-core/gmond/modules/python/Makefile.am =================================================================== --- trunk/monitor-core/gmond/modules/python/Makefile.am 2010-01-13 19:05:29 UTC (rev 2223) +++ trunk/monitor-core/gmond/modules/python/Makefile.am 2010-01-14 16:16:26 UTC (rev 2224) @@ -1,3 +1,6 @@ + +include $(top_srcdir)/ganglia.inc + AM_CFLAGS = -D_LARGEFILE64_SOURCE -I$(top_builddir)/include -I$(top_builddir)/lib if STATIC_BUILD @@ -9,7 +12,19 @@ modpython_la_SOURCES = mod_python.c modpython_la_LDFLAGS = -module -avoid-version -lpython@PYTHON_VERSION@ -EXTRA_DIST = ../conf.d/modpython.conf +EXTRA_DIST = README.in ../conf.d/modpython.conf.in endif +README: README.in $(FIXCONFIG) + $(FIXCONFIG) README.in + +../conf.d/modpython.conf: ../conf.d/modpython.conf.in $(FIXCONFIG) + $(FIXCONFIG) ../conf.d/modpython.conf.in + +# Note that README is listed as a dependency to be generated, but it +# is not currently installed anywhere +install-exec-hook: ../conf.d/modpython.conf README + mkdir -p $(DESTDIR)/$(sysconfdir)/conf.d && \ + $(INSTALL_DATA) ../conf.d/modpython.conf $(DESTDIR)/$(sysconfdir)/conf.d/modpython.conf + INCLUDES = @APR_INCLUDES@ @PYTHON_INCLUDES@ Modified: trunk/monitor-core/gmond/modules/python/README.in =================================================================== --- trunk/monitor-core/gmond/modules/python/README.in 2010-01-13 19:05:29 UTC (rev 2223) +++ trunk/monitor-core/gmond/modules/python/README.in 2010-01-14 16:16:26 UTC (rev 2224) @@ -105,7 +105,7 @@ } } - include ('/etc/ganglia/conf.d/*.pyconf') + include ('@sysconfdir@/conf.d/*.pyconf') The most significant part of this configuration is the 'params' directive. The path that has been assigned to this directive will Added: trunk/monitor-core/scripts/fixconfig.in =================================================================== --- trunk/monitor-core/scripts/fixconfig.in (rev 0) +++ trunk/monitor-core/scripts/fixconfig.in 2010-01-14 16:16:26 UTC (rev 2224) @@ -0,0 +1,86 @@ +#! /bin/sh + +## $Id$ +## +## Make variable substitutions in configuration files. +## +## This script does something very similar to what config.status does, but +## it fully resolves the various path variables (prefix, exec_prefix, etc.) +## so that they don't contain any variable substitutions. It's easier to +## do this in a separate script than try to use eval or the like to resolve +## the variable names inside configure, particularly since prefix and +## exec_prefix aren't set until the end of the script. +## +## The original form of this script was taken from the INN project +## which is under a BSD-style license +## + +# The paths set by configure. +prefix="@prefix@" +exec_prefix="@exec_prefix@" +bindir="@bindir@" +libexecdir="@libexecdir@" +libdir="@libdir@" +sbindir="@sbindir@" +sysconfdir="@sysconfdir@" +includedir="@includedir@" + +# Additional variables set by configure +CFLAGS="@CFLAGS@" +LDFLAGS="@LDFLAGS@" +LIBS="@LIBS@" +VERSION="@VERSION@" +host_cpu="@host_cpu@" + +# Additional paths specific to Ganglia. +moduledir="@moduledir@" +varstatedir="@varstatedir@" + +# Additional variables that are substituted into configuration files. +GANGLIA_MAJOR_VERSION="@GANGLIA_MAJOR_VERSION@" +GANGLIA_MICRO_VERSION="@GANGLIA_MICRO_VERSION@" +GANGLIA_MINOR_VERSION="@GANGLIA_MINOR_VERSION@" +GANGLIA_VERSION="@GANGLIA_VERSION@" +REL="@REL@" + +# We can probably just assume sed is on the path, but since we have it, we may +# as well use it. +SED="@SED@" + +input="$1" +if [ -z "$input" ] ; then + echo "No input file specified" >&2 + exit 1 +fi + +output="$2" +if [ -z "$output" ] ; then + output=`echo "$input" | $SED -e 's/\.in$//'` +fi +if [ x"$input" = x"$output" ] ; then + echo "No output file specified and input file doesn't end in .in" >&2 + exit 1 +fi + +$SED -e "s,@prefix[@],$prefix,g" \ + -e "s,@exec_prefix[@],$exec_prefix,g" \ + -e "s,@bindir[@],$bindir,g" \ + -e "s,@libexecdir[@],$libexecdir,g" \ + -e "s,@libdir[@],$libdir,g" \ + -e "s,@sbindir[@],$sbindir,g" \ + -e "s,@sysconfdir[@],$sysconfdir,g" \ + -e "s,@includedir[@],$includedir,g" \ + -e "s,@CFLAGS[@],$CFLAGS,g" \ + -e "s,@LDFLAGS[@],$LDFLAGS,g" \ + -e "s,@LIBS[@],$LIBS,g" \ + -e "s,@VERSION[@],$VERSION,g" \ + -e "s,@host_cpu[@],$host_cpu,g" \ + -e "s,@moduledir[@],$moduledir,g" \ + -e "s,@varstatedir[@],$varstatedir,g" \ + -e "s,@GANGLIA_MAJOR_VERSION[@],$GANGLIA_MAJOR_VERSION,g" \ + -e "s,@GANGLIA_MICRO_VERSION[@],$GANGLIA_MICRO_VERSION,g" \ + -e "s,@GANGLIA_MINOR_VERSION[@],$GANGLIA_MINOR_VERSION,g" \ + -e "s,@GANGLIA_VERSION[@],$GANGLIA_VERSION,g" \ + -e "s,@REL[@],$REL,g" \ + < "$input" > "$output" + Modified: trunk/monitor-core/web/Makefile.am =================================================================== --- trunk/monitor-core/web/Makefile.am 2010-01-13 19:05:29 UTC (rev 2223) +++ trunk/monitor-core/web/Makefile.am 2010-01-14 16:16:26 UTC (rev 2224) @@ -1,4 +1,13 @@ -install: + +include $(top_srcdir)/ganglia.inc + +conf.php: conf.php.in $(FIXCONFIG) + $(FIXCONFIG) conf.php.in + +version.php: version.php.in $(FIXCONFIG) + $(FIXCONFIG) version.php.in + +install: conf.php version.php @echo @echo "=================================================================================" @echo " The PHP scripts are not installed by running 'make install'" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |