From 0a5cb637d4e25ab94f8dcfd8ab2d205eac90bec3 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 12 Feb 2016 10:12:13 +1100 Subject: [PATCH] ctdb: Install helpers under libexecdir Signed-off-by: Martin Schwenke Reviewed-by: Andreas Schneider --- ctdb/config/events.d/11.natgw | 2 +- ctdb/config/functions | 4 ++++ ctdb/config/statd-callout | 9 +++++---- ctdb/packaging/RPM/ctdb.spec.in | 11 ++++++----- ctdb/tests/eventscripts/scripts/local.sh | 1 + ctdb/wscript | 19 +++++++++++-------- 6 files changed, 28 insertions(+), 18 deletions(-) diff --git a/ctdb/config/events.d/11.natgw b/ctdb/config/events.d/11.natgw index 956f77b0d7b..25cf27fa202 100755 --- a/ctdb/config/events.d/11.natgw +++ b/ctdb/config/events.d/11.natgw @@ -168,7 +168,7 @@ natgw_set_slave () natgw_ensure_master () { - set -- $(ctdb_natgw master) + set -- $("${CTDB_HELPER_BINDIR}/ctdb_natgw" master) natgwmaster="${1:--1}" # Default is -1 if natgwlist fails natgwip="$2" diff --git a/ctdb/config/functions b/ctdb/config/functions index b714c63223c..eab5563789f 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -20,6 +20,10 @@ if [ -z "$CTDB_SYS_ETCDIR" ] ; then CTDB_SYS_ETCDIR="/etc" fi +if [ -z "$CTDB_HELPER_BINDIR" ] ; then + CTDB_HELPER_BINDIR="/usr/local/libexec/ctdb" +fi + ####################################### # pull in a system config file, if any diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout index f56e50f019a..a923d8a89b5 100755 --- a/ctdb/config/statd-callout +++ b/ctdb/config/statd-callout @@ -168,6 +168,7 @@ case "$1" in statd_state=$(ctdb catdb ctdb.tdb | sed -n "$sed_expr" | sort) [ -n "$statd_state" ] || exit 0 + smnotify="${CTDB_HELPER_BINDIR}/smnotify" prev="" echo "$statd_state" | { # This all needs to be in the same command group at the @@ -186,12 +187,12 @@ case "$1" in # Reset stateval for each serverip [ "$sip" = "$prev" ] || stateval="$state_even" # Send notifies for server shutdown - smnotify --client=$cip --ip=$sip --server=$sip --stateval=$stateval - smnotify --client=$cip --ip=$sip --server=$NFS_HOSTNAME --stateval=$stateval + "$smnotify" --client=$cip --ip=$sip --server=$sip --stateval=$stateval + "$smnotify" --client=$cip --ip=$sip --server=$NFS_HOSTNAME --stateval=$stateval # Send notifies for server startup stateval=$(($stateval + 1)) - smnotify --client=$cip --ip=$sip --server=$sip --stateval=$stateval - smnotify --client=$cip --ip=$sip --server=$NFS_HOSTNAME --stateval=$stateval + "$smnotify" --client=$cip --ip=$sip --server=$sip --stateval=$stateval + "$smnotify" --client=$cip --ip=$sip --server=$NFS_HOSTNAME --stateval=$stateval done echo "$items" | ctdb ptrans "ctdb.tdb" diff --git a/ctdb/packaging/RPM/ctdb.spec.in b/ctdb/packaging/RPM/ctdb.spec.in index 420ec520a69..1547dfb9841 100644 --- a/ctdb/packaging/RPM/ctdb.spec.in +++ b/ctdb/packaging/RPM/ctdb.spec.in @@ -195,15 +195,16 @@ rm -rf $RPM_BUILD_ROOT %{_sbindir}/ctdbd %{_sbindir}/ctdbd_wrapper %{_bindir}/ctdb -%{_bindir}/ctdb_lock_helper -%{_bindir}/ctdb_event_helper -%{_bindir}/ctdb_recovery_helper -%{_bindir}/smnotify %{_bindir}/ping_pong %{_bindir}/ltdbtool %{_bindir}/ctdb_diagnostics %{_bindir}/onnode -%{_bindir}/ctdb_natgw +%dir %{_libexecdir}/ctdb +%{_libexecdir}/ctdb/ctdb_lock_helper +%{_libexecdir}/ctdb/ctdb_event_helper +%{_libexecdir}/ctdb/ctdb_recovery_helper +%{_libexecdir}/ctdb/ctdb_natgw +%{_libexecdir}/ctdb/smnotify %dir %{_libdir} %{_libdir}/ctdb/lib* %{_libdir}/libtevent-unix-util.so.0* diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh index 82ebc098d6f..fcb751901b8 100644 --- a/ctdb/tests/eventscripts/scripts/local.sh +++ b/ctdb/tests/eventscripts/scripts/local.sh @@ -13,6 +13,7 @@ if [ -d "${TEST_SUBDIR}/stubs" ] ; then /*) : ;; *) EVENTSCRIPTS_PATH="${PWD}/${EVENTSCRIPTS_PATH}" ;; esac + export CTDB_HELPER_BINDIR="$EVENTSCRIPTS_PATH" fi export EVENTSCRIPTS_PATH diff --git a/ctdb/wscript b/ctdb/wscript index c27f8692a8e..43cbbc9d446 100755 --- a/ctdb/wscript +++ b/ctdb/wscript @@ -181,6 +181,7 @@ def configure(conf): conf.env.CTDB_ETCDIR = os.path.join(conf.env.SYSCONFDIR, 'ctdb') conf.env.CTDB_VARDIR = os.path.join(conf.env.LOCALSTATEDIR, 'lib/ctdb') conf.env.CTDB_RUNDIR = os.path.join(conf.env.LOCALSTATEDIR, 'run/ctdb') + conf.env.CTDB_HELPER_BINDIR = os.path.join(conf.env.LIBEXECDIR, 'ctdb') if Options.options.ctdb_logdir: conf.env.CTDB_LOGDIR = Options.options.ctdb_logdir @@ -199,7 +200,7 @@ def configure(conf): -DCTDB_ETCDIR=\"%s\" -DCTDB_VARDIR=\"%s\" -DCTDB_RUNDIR=\"%s\"''' % ( - conf.env.CTDB_BINDIR, + conf.env.CTDB_HELPER_BINDIR, conf.env.CTDB_LOGDIR, conf.env.CTDB_ETCDIR, conf.env.CTDB_VARDIR, @@ -432,19 +433,19 @@ def build(bld): source='server/ctdb_lock_helper.c', deps='samba-util ctdb-system talloc tdb', includes='include', - install_path='${BINDIR}') + install_path='${CTDB_HELPER_BINDIR}') bld.SAMBA_BINARY('ctdb_event_helper', source='server/ctdb_event_helper.c', includes='include', deps='samba-util ctdb-system replace tdb', - install_path='${BINDIR}') + install_path='${CTDB_HELPER_BINDIR}') bld.SAMBA_BINARY('ctdb_recovery_helper', source='server/ctdb_recovery_helper.c', deps='''ctdb-client2 ctdb-protocol ctdb-util samba-util replace tdb''', - install_path='${BINDIR}') + install_path='${CTDB_HELPER_BINDIR}') bld.SAMBA_GENERATOR('ctdb-smnotify-h', source='utils/smnotify/smnotify.x', @@ -468,7 +469,7 @@ def build(bld): 'smnotify.c gen_smnotify.c gen_xdr.c'), deps='ctdb-smnotify-h ctdb-smnotify-c ctdb-smnotify-x popt', includes='utils utils/smnotify', - install_path='${BINDIR}') + install_path='${CTDB_HELPER_BINDIR}') bld.SAMBA_BINARY('ping_pong', source='utils/ping_pong/ping_pong.c', @@ -500,8 +501,10 @@ def build(bld): sed_expr3 = 's|/usr/local/var/log|%s|g' % (bld.env.CTDB_LOGDIR) sed_expr4 = 's|/usr/local/var/run/ctdb|%s|g' % (bld.env.CTDB_RUNDIR) sed_expr5 = 's|/usr/local/sbin|%s|g' % (bld.env.SBINDIR) - sed_cmdline = '-e "%s" -e "%s" -e "%s" -e "%s" -e "%s"' % \ - (sed_expr1, sed_expr2, sed_expr3, sed_expr4, sed_expr5) + sed_expr6 = 's|/usr/local/libexec/ctdb|%s|g' % (bld.env.CTDB_HELPER_BINDIR) + sed_cmdline = '-e "%s" -e "%s" -e "%s" -e "%s" -e "%s" -e "%s"' % \ + (sed_expr1, sed_expr2, sed_expr3, sed_expr4, sed_expr5, + sed_expr6) for f in manpages: x = '%s.xml' % (f) @@ -540,7 +543,7 @@ def build(bld): source='tools/ctdb_natgw', target='ctdb_natgw', rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline)) - bld.INSTALL_FILES('${BINDIR}', 'ctdb_natgw', + bld.INSTALL_FILES('${CTDB_HELPER_BINDIR}', 'ctdb_natgw', destname='ctdb_natgw', chmod=0755) bld.SAMBA_GENERATOR('ctdbd-wrapper',