From 1cc5f8f6168db2646a29c29d6438a5d81b5731fe Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox@samba.org>
Date: Wed, 8 Jun 2016 12:08:35 +0200
Subject: [PATCH] ctdb: set the path to 'ctdb' in 'functions' in CTDB

Allow this to be overridden from the caller.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
---
 ctdb/config/functions | 2 ++
 ctdb/wscript          | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ctdb/config/functions b/ctdb/config/functions
index b2a0735a221..70325400ec2 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -10,6 +10,8 @@ fi
 CTDB_VARDIR="/usr/local/var/lib/ctdb"
 ctdb_rundir="/usr/local/var/run/ctdb"
 
+CTDB="${CTDB:-/usr/local/bin/ctdb}"
+
 # Only (and always) override these variables in test code
 
 if [ -z "$CTDB_SCRIPT_VARDIR" ] ; then
diff --git a/ctdb/wscript b/ctdb/wscript
index 6a411dadb44..60ea824b7e9 100755
--- a/ctdb/wscript
+++ b/ctdb/wscript
@@ -515,9 +515,10 @@ def build(bld):
     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_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_expr7 = 's|/usr/local/bin|%s|g'           % (bld.env.BINDIR)
+    sed_cmdline = '-e "%s" -e "%s" -e "%s" -e "%s" -e "%s" -e "%s" -e "%s"' % \
                        (sed_expr1, sed_expr2, sed_expr3, sed_expr4, sed_expr5,
-                        sed_expr6)
+                        sed_expr6, sed_expr7)
 
     for f in manpages:
         x = '%s.xml' % (f)