From c8a620fd24f3ded08c3cdc5dd62c7856fc2fcab2 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 28 Aug 2012 09:04:21 +0200 Subject: [PATCH] build: make path to bash configurable at build time Signed-off-by: Fabio M. Di Nitto Reviewed-by: Jan Friesse --- configure.ac | 2 ++ cts/agents/Makefile.am | 14 ++++++++++++++ ...ch-deadlock.sh => cmap-dispatch-deadlock.sh.in} | 2 +- .../{shm_leak_audit.sh => shm_leak_audit.sh.in} | 2 +- init/Makefile.am | 1 + init/corosync-notifyd.in | 2 +- init/corosync.in | 2 +- test/Makefile.am | 2 +- test/ploadstart.sh | 2 +- tools/Makefile.am | 4 +++- tools/corosync-xmlproc.sh | 2 +- 11 files changed, 27 insertions(+), 8 deletions(-) rename cts/agents/{cmap-dispatch-deadlock.sh => cmap-dispatch-deadlock.sh.in} (98%) rename cts/agents/{shm_leak_audit.sh => shm_leak_audit.sh.in} (98%) mode change 100755 => 100644 diff --git a/configure.ac b/configure.ac index 5b9971f0..a432dbe6 100644 --- a/configure.ac +++ b/configure.ac @@ -77,6 +77,7 @@ AC_CHECK_PROGS([DOT], [dot]) AC_CHECK_PROGS([DOXYGEN], [doxygen]) AC_CHECK_PROGS([AWK], [awk]) AC_CHECK_PROGS([SED], [sed]) +AC_PATH_PROG([BASHPATH], [bash]) # Checks for compiler characteristics. AC_PROG_GCC_TRADITIONAL @@ -601,6 +602,7 @@ CPPFLAGS="$ENV_CPPFLAGS $ANSI_CPPFLAGS $OS_CPPFLAGS" LDFLAGS="$ENV_LDFLAGS $COVERAGE_LDFLAGS $OS_LDFLAGS" # substitute what we need: +AC_SUBST([BASHPATH]) AC_SUBST([INITDDIR]) AC_SUBST([SYSTEMDDIR]) INITWRAPPERSDIR=$(eval echo ${INITWRAPPERSDIR}) diff --git a/cts/agents/Makefile.am b/cts/agents/Makefile.am index 0edc4788..66038900 100644 --- a/cts/agents/Makefile.am +++ b/cts/agents/Makefile.am @@ -31,6 +31,9 @@ MAINTAINERCLEANFILES = Makefile.in +EXTRA_DIST = cmap-dispatch-deadlock.sh.in \ + shm_leak_audit.sh.in + TEST_AGENTS = cpg_test_agent \ sam_test_agent \ votequorum_test_agent @@ -51,6 +54,14 @@ noinst_PROGRAMS = $(TEST_AGENTS) noinst_SCRIPTS = $(SHELL_TESTS) endif +cmap-dispatch-deadlock.sh: cmap-dispatch-deadlock.sh.in + sed -e 's#@''BASHPATH@#${BASHPATH}#g' $< > $@ + chmod 755 $@ + +shm_leak_audit.sh: shm_leak_audit.sh.in + sed -e 's#@''BASHPATH@#${BASHPATH}#g' $< > $@ + chmod 755 $@ + AM_CPPFLAGS = -I$(top_builddir)/include \ -I$(top_srcdir)/include \ -I$(top_builddir)/include/corosync @@ -77,6 +88,9 @@ votequorum_test_agent_LDADD = $(LIBQB_LIBS) \ $(top_builddir)/lib/libvotequorum.la \ $(top_builddir)/common_lib/libcorosync_common.la +clean-local: + rm -f shm_leak_audit.sh cmap-dispatch-deadlock.sh + lint: -splint $(LINT_FLAGS) $(CFLAGS) *.c diff --git a/cts/agents/cmap-dispatch-deadlock.sh b/cts/agents/cmap-dispatch-deadlock.sh.in similarity index 98% rename from cts/agents/cmap-dispatch-deadlock.sh rename to cts/agents/cmap-dispatch-deadlock.sh.in index 1ccc5bd6..e5e45677 100644 --- a/cts/agents/cmap-dispatch-deadlock.sh +++ b/cts/agents/cmap-dispatch-deadlock.sh.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASHPATH@ export TIMEOUT=600 export PID=$$ diff --git a/cts/agents/shm_leak_audit.sh b/cts/agents/shm_leak_audit.sh.in old mode 100755 new mode 100644 similarity index 98% rename from cts/agents/shm_leak_audit.sh rename to cts/agents/shm_leak_audit.sh.in index ad6dc847..0272705e --- a/cts/agents/shm_leak_audit.sh +++ b/cts/agents/shm_leak_audit.sh.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASHPATH@ service corosync status >/dev/null diff --git a/init/Makefile.am b/init/Makefile.am index 21d1e22b..804ad7cf 100644 --- a/init/Makefile.am +++ b/init/Makefile.am @@ -53,6 +53,7 @@ initscript_SCRIPTS = corosync corosync-notifyd -e 's#@''INITDDIR@#$(INITDDIR)#g' \ -e 's#@''INITWRAPPERSDIR@#$(INITWRAPPERSDIR)#g' \ -e 's#@''LOCALSTATEDIR@#$(localstatedir)#g' \ + -e 's#@''BASHPATH@#${BASHPATH}#g' \ > $@-t mv $@-t $@ diff --git a/init/corosync-notifyd.in b/init/corosync-notifyd.in index 84de9aea..37118216 100755 --- a/init/corosync-notifyd.in +++ b/init/corosync-notifyd.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASHPATH@ # Authors: # Angus Salkeld diff --git a/init/corosync.in b/init/corosync.in index a9840bd9..cfd51f2b 100755 --- a/init/corosync.in +++ b/init/corosync.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASHPATH@ # Authors: # Andrew Beekhof diff --git a/test/Makefile.am b/test/Makefile.am index a7c3c63e..777a1f0e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -64,7 +64,7 @@ cpgbenchzc_LDADD = $(LIBQB_LIBS) $(top_builddir)/lib/libcpg.la testsam_LDADD = $(LIBQB_LIBS) $(top_builddir)/lib/libsam.la ploadstart: ploadstart.sh - cp $^ $@ + sed -e 's#@''BASHPATH@#${BASHPATH}#g' $< > $@ chmod 755 $@ LINT_FILES1:=$(filter-out sa_error.c, $(wildcard *.c)) diff --git a/test/ploadstart.sh b/test/ploadstart.sh index 7bd7c9d9..bea065b8 100644 --- a/test/ploadstart.sh +++ b/test/ploadstart.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASHPATH@ set -e diff --git a/tools/Makefile.am b/tools/Makefile.am index 6abc972b..e9945167 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -47,7 +47,9 @@ EXTRA_DIST = $(bin_SCRIPTS) corosync-xmlproc.sh \ corosync-blackbox.sh corosync-xmlproc: corosync-xmlproc.sh - sed -e 's#@''DATADIR@#${datadir}#g' $< > $@ + sed -e 's#@''DATADIR@#${datadir}#g' \ + -e 's#@''BASHPATH@#${BASHPATH}#g' \ + $< > $@ corosync-blackbox: corosync-blackbox.sh sed -e 's#@''LOCALSTATEDIR@#${localstatedir}#g' $< > $@ diff --git a/tools/corosync-xmlproc.sh b/tools/corosync-xmlproc.sh index d6b24aa6..c098958f 100644 --- a/tools/corosync-xmlproc.sh +++ b/tools/corosync-xmlproc.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASHPATH@ # Copyright (c) 2011 Red Hat, Inc. #