param: Rename variable used for lp_client_plaintext_auth bClientPlaintextAuth
[Samba.git] / ctdb / tests / INSTALL
blob5581989619b542c3f1c8e6c874e321c0e5bedea8
1 #!/bin/sh
3 # Script to install the CTDB testsuite on a machine.
5 usage ()
7 if [ -n "$1" ] ; then
8 echo "$1"
9 echo
12 cat <<EOF
13 $0 --destdir=<DIR1> \\
14 --datarootdir=<DIR2> \\
15 --libdir=<DIR3> \\
16 --bindir=<DIR4> \\
17 --etcdir=<DIR5>
18 EOF
19 exit 1
22 parse_options ()
24 temp=$(getopt -n "$prog" -o "h" -l help,destdir:,datarootdir:,libdir:,bindir:,etcdir: -- "$@")
26 [ $? != 0 ] && usage
28 eval set -- "$temp"
30 destdir=""
31 datarootdir=""
32 libdir=""
33 bindir=""
34 etcdir=""
36 while true ; do
37 case "$1" in
38 --destdir) destdir="$2" ; shift 2 ;;
39 --datarootdir) datarootdir="$2" ; shift 2 ;;
40 --libdir) libdir="$2" ; shift 2 ;;
41 --bindir) bindir="$2" ; shift 2 ;;
42 --etcdir) etcdir="$2" ; shift 2 ;;
43 --) shift ; break ;;
44 -h|--help|*) usage ;; # Shouldn't happen, so this is reasonable.
45 esac
46 done
48 [ $# -gt 0 ] && usage
50 [ -n "$destdir" ] || usage "No option --destdir specified"
51 [ -n "$datarootdir" ] || usage "No option --datarootdir specified"
52 [ -n "$libdir" ] || usage "No option --libdir specified"
53 [ -n "$bindir" ] || usage "No option --bindir specified"
54 [ -n "$etcdir" ] || usage "No option --etcdir specified"
57 parse_options "$@"
59 # Make things neater!
60 if [ "$destdir" = "/" ] ; then
61 destdir=""
64 data_subdirs="complex events.d eventscripts onnode scripts simple takeover tool"
66 ctdb_datadir="${destdir}${datarootdir}/ctdb-tests"
67 echo "Installing test data files into ${ctdb_datadir}..."
68 for d in $data_subdirs ; do
69 mkdir -p "${ctdb_datadir}/${d}"
70 cp -pr "tests/${d}" "${ctdb_datadir}"
71 done
72 # Some of the unit tests have relative symlinks back to in-tree bits
73 # and pieces. These links will be broken!
74 for i in "events.d" "functions" "nfs-rpc-checks.d" ; do
75 ln -sf "${etcdir}/ctdb/${i}" "${ctdb_datadir}/eventscripts/etc-ctdb/${i}"
76 done
77 # test_wrap needs to set TEST_BIN_DIR
78 sed -i -e "s@^TEST_SCRIPTS_DIR=.*@&\nexport TEST_BIN_DIR=\"${libdir}/ctdb-tests\"@" "${ctdb_datadir}/scripts/test_wrap"
80 ctdb_libdir="${destdir}${libdir}/ctdb-tests"
81 mkdir -p "${destdir}${libdir}"
82 echo "Installing test binary files into ${ctdb_libdir}..."
83 cp -pr "tests/bin/" "${ctdb_libdir}"
85 ctdb_bindir="${destdir}${bindir}"
86 echo "Installing wrapper scripts into ${ctdb_bindir}..."
87 mkdir -p "${ctdb_bindir}"
88 out="${ctdb_bindir}/ctdb_run_tests"
89 sed -e "s@^test_dir=.*@test_dir=${datarootdir}/ctdb-tests\nexport TEST_BIN_DIR=\"${libdir}/ctdb-tests\"@" "tests/run_tests.sh" >"$out"
90 chmod 755 "$out"
91 ln -s "ctdb_run_tests" "${ctdb_bindir}/ctdb_run_cluster_tests"