backupkey: replace heimdal rsa key generation with GnuTLS
[Samba.git] / ctdb / tests / INSTALL
blob23dcdaf2e6a4af056afe72703c8bb2034a600b66
1 #!/bin/sh
3 # Stop on 1st error
4 set -e
6 # Script to install the CTDB testsuite on a machine.
8 usage ()
10 if [ -n "$1" ] ; then
11 echo "$1"
12 echo
15 cat <<EOF
16 $0 --destdir=<DIR1> \\
17 --datarootdir=<DIR2> \\
18 --libdir=<DIR3> \\
19 --bindir=<DIR4> \\
20 --etcdir=<DIR5>
21 EOF
22 exit 1
25 parse_options ()
27 temp=$(getopt -n "$prog" -o "h" -l help,destdir:,datarootdir:,libdir:,bindir:,etcdir: -- "$@")
29 [ $? != 0 ] && usage
31 eval set -- "$temp"
33 destdir=""
34 datarootdir=""
35 libdir=""
36 bindir=""
37 etcdir=""
39 while true ; do
40 case "$1" in
41 --destdir) destdir="$2" ; shift 2 ;;
42 --datarootdir) datarootdir="$2" ; shift 2 ;;
43 --libdir) libdir="$2" ; shift 2 ;;
44 --bindir) bindir="$2" ; shift 2 ;;
45 --etcdir) etcdir="$2" ; shift 2 ;;
46 --) shift ; break ;;
47 -h|--help|*) usage ;; # Shouldn't happen, so this is reasonable.
48 esac
49 done
51 [ $# -gt 0 ] && usage
53 [ -n "$destdir" ] || usage "No option --destdir specified"
54 [ -n "$datarootdir" ] || usage "No option --datarootdir specified"
55 [ -n "$libdir" ] || usage "No option --libdir specified"
56 [ -n "$bindir" ] || usage "No option --bindir specified"
57 [ -n "$etcdir" ] || usage "No option --etcdir specified"
60 parse_options "$@"
62 # Make things neater!
63 if [ "$destdir" = "/" ] ; then
64 destdir=""
67 data_subdirs="complex events.d eventscripts onnode scripts simple takeover tool"
69 ctdb_datadir="${destdir}${datarootdir}/ctdb-tests"
70 echo "Installing test data files into ${ctdb_datadir}..."
71 for d in $data_subdirs ; do
72 mkdir -p "${ctdb_datadir}/${d}"
73 cp -pr "tests/${d}" "${ctdb_datadir}"
74 done
75 # Some of the unit tests have relative symlinks back to in-tree bits
76 # and pieces. These links will be broken!
77 link_dir="${ctdb_datadir}/eventscripts/etc-ctdb/"
78 broken_links=$(find "$link_dir" -type l | sed -e "s@^${link_dir}@@")
79 for i in $broken_links ; do
80 ln -sf "${etcdir}/ctdb/${i}" "${ctdb_datadir}/eventscripts/etc-ctdb/${i}"
81 done
82 # test_wrap needs to set TEST_BIN_DIR
83 sed -i -e "s@^TEST_SCRIPTS_DIR=.*@&\nexport TEST_BIN_DIR=\"${libdir}/ctdb-tests\"@" "${ctdb_datadir}/scripts/test_wrap"
85 ctdb_libdir="${destdir}${libdir}/ctdb-tests"
86 mkdir -p "${destdir}${libdir}"
87 echo "Installing test binary files into ${ctdb_libdir}..."
88 cp -pr "tests/bin/" "${ctdb_libdir}"
90 ctdb_bindir="${destdir}${bindir}"
91 echo "Installing wrapper scripts into ${ctdb_bindir}..."
92 mkdir -p "${ctdb_bindir}"
93 out="${ctdb_bindir}/ctdb_run_tests"
94 sed -e "s@^test_dir=.*@test_dir=${datarootdir}/ctdb-tests\nexport TEST_BIN_DIR=\"${libdir}/ctdb-tests\"@" -e 's@^\(export CTDB_TESTS_ARE_INSTALLED\)=false@\1=true@' "tests/run_tests.sh" >"$out"
95 chmod 755 "$out"
96 ln -s "ctdb_run_tests" "${ctdb_bindir}/ctdb_run_cluster_tests"