winbind: Fix a memleak
[vlendec/samba-autobuild/.git] / ctdb / tests / scripts / script_install_paths.sh
1 # Hey Emacs, this is a -*- shell-script -*- !!!  :-)
2
3 # Sets $bin_dir
4 find_bin_dir ()
5 {
6         _ctdb_dir="$1"
7
8         bin_dir="$(pwd -P)/bin"
9         if [ -d "$(pwd -P)/bin" ] ; then
10                 return
11         fi
12
13         bin_dir="${_ctdb_dir}/bin"
14         if [ -d "$bin_dir" ] ; then
15                 return
16         fi
17
18         bin_dir="$(dirname "${_ctdb_dir}")/bin"
19         if [ -d "$bin_dir" ] ; then
20                 return
21         fi
22
23         die "Unable to locate bin/ subdirectory"
24 }
25
26
27 if ! $CTDB_TESTS_ARE_INSTALLED ; then
28         if [ ! -f "${CTDB_TEST_DIR}/run_tests.sh" ] ; then
29                 die "Tests not installed but can't find run_tests.sh"
30         fi
31
32         ctdb_dir=$(cd -P "$(dirname "$CTDB_TEST_DIR")" && pwd) # real path
33
34         find_bin_dir "$ctdb_dir"
35
36         CTDB_SCRIPTS_BASE="${ctdb_dir}/config"
37         CTDB_SCRIPTS_INIT_SCRIPT="${ctdb_dir}/config/ctdb.init"
38         CTDB_SCRIPTS_SBIN_DIR="${ctdb_dir}/config"
39         CTDB_SCRIPTS_TOOLS_BIN_DIR="${ctdb_dir}/tools"
40         CTDB_SCRIPTS_TOOLS_HELPER_DIR="${ctdb_dir}/tools"
41         CTDB_SCRIPTS_HELPER_BINDIR="$bin_dir"
42         CTDB_SCRIPTS_DATA_DIR="${ctdb_dir}/config"
43         CTDB_SCRIPTS_TESTS_LIBEXEC_DIR="$bin_dir"
44         CTDB_SCRIPTS_TESTS_BIN_DIR="$CTDB_TEST_DIR"
45 else
46         # Installed
47         CTDB_SCRIPTS_BASE="/usr/local/etc/ctdb"
48         CTDB_SCRIPTS_INIT_SCRIPT="" # No ideas here... this is a packaging choice
49         CTDB_SCRIPTS_SBIN_DIR="/usr/local/sbin"
50         CTDB_SCRIPTS_TOOLS_BIN_DIR="/usr/local/bin"
51         CTDB_SCRIPTS_TOOLS_HELPER_DIR="/usr/local/libexec/ctdb"
52         CTDB_SCRIPTS_HELPER_BINDIR="/usr/local/libexec/ctdb"
53         CTDB_SCRIPTS_DATA_DIR="/usr/local/share/ctdb"
54         CTDB_SCRIPTS_TESTS_LIBEXEC_DIR="/usr/local/libexec/ctdb/tests"
55         CTDB_SCRIPTS_TESTS_BIN_DIR="/usr/local/bin"
56 fi
57
58 export CTDB_SCRIPTS_BASE \
59        CTDB_SCRIPTS_BIN_DIR \
60        CTDB_SCRIPTS_INIT_SCRIPT \
61        CTDB_SCRIPTS_SBIN_DIR \
62        CTDB_SCRIPTS_TOOLS_BIN_DIR \
63        CTDB_SCRIPTS_TOOLS_HELPER_DIR \
64        CTDB_SCRIPTS_HELPER_BINDIR \
65        CTDB_SCRIPTS_DATA_DIR \
66        CTDB_SCRIPTS_TESTS_LIBEXEC_DIR \
67        CTDB_SCRIPTS_TESTS_BIN_DIR