summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-07-06 16:38:43 +1000
committerAmitay Isaacs <amitay@samba.org>2018-07-11 11:48:38 +0200
commit06be1c8593fc84068896b428bdc39e7033bd85e2 (patch)
tree06ffb35571273677599a0b479aadaea29e76e4c4 /ctdb
parenta3610d1cbcebb0fe81505d42276604804a112d9a (diff)
downloadsamba-06be1c8593fc84068896b428bdc39e7033bd85e2.tar.gz
ctdb-build: Install event scripts in CTDB_DATADIR
Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/packaging/RPM/ctdb.spec.in6
-rw-r--r--ctdb/tests/eventscripts/scripts/local.sh9
-rwxr-xr-xctdb/tests/shellcheck/event_scripts.sh2
-rw-r--r--ctdb/wscript12
4 files changed, 22 insertions, 7 deletions
diff --git a/ctdb/packaging/RPM/ctdb.spec.in b/ctdb/packaging/RPM/ctdb.spec.in
index b07401fc1b9..2aeb6c358eb 100644
--- a/ctdb/packaging/RPM/ctdb.spec.in
+++ b/ctdb/packaging/RPM/ctdb.spec.in
@@ -128,10 +128,7 @@ mkdir -p $RPM_BUILD_ROOT%{initdir}
install -m755 config/ctdb.init $RPM_BUILD_ROOT%{initdir}/ctdb
%endif
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/events/notification
-
# This is a hack. All documents should be installed in /usr/share/doc.
-rm -f $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/events/README
cp config/events/README README.eventscripts
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/nfs-checks.d/README
cp config/nfs-checks.d/README README.nfs-checks.d
@@ -155,7 +152,6 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) %{_sysconfdir}/ctdb/ctdb.tunables
%config(noreplace) %{_sysconfdir}/ctdb/script.options
%{_sysconfdir}/ctdb/notify.sh
-%dir %{_sysconfdir}/ctdb/events/notification
%config(noreplace) %{_sysconfdir}/ctdb/debug-hung-script.sh
%config(noreplace) %{_sysconfdir}/ctdb/ctdb-crash-cleanup.sh
%config(noreplace) %{_sysconfdir}/ctdb/debug_locks.sh
@@ -199,6 +195,8 @@ rm -rf $RPM_BUILD_ROOT
%{_libexecdir}/ctdb/*
%dir %{_libdir}
%{_libdir}/ctdb/lib*
+%dir %{_datadir}/ctdb/events
+%{_datadir}/ctdb/events/*
%{_mandir}/man1/ctdb.1.gz
%{_mandir}/man1/ctdb_diagnostics.1.gz
%{_mandir}/man1/ctdbd.1.gz
diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh
index 28fc2363a78..03df06860e9 100644
--- a/ctdb/tests/eventscripts/scripts/local.sh
+++ b/ctdb/tests/eventscripts/scripts/local.sh
@@ -40,7 +40,6 @@ else
fi
setup_ctdb_base "$EVENTSCRIPTS_TESTS_VAR_DIR" "etc-ctdb" \
- events \
functions \
nfs-checks.d \
nfs-linux-kernel-callout \
@@ -467,8 +466,16 @@ define_test ()
unset event
;;
esac
+ # "Enable" the script
_subdir="events/legacy"
script_dir="${CTDB_BASE}/${_subdir}"
+ # Symlink target needs to be absolute
+ case "$CTDB_SCRIPTS_DATA_DIR" in
+ /*) _data_dir="${CTDB_SCRIPTS_DATA_DIR}/${_subdir}" ;;
+ *) _data_dir="${PWD}/${CTDB_SCRIPTS_DATA_DIR}/${_subdir}"
+ esac
+ mkdir -p "$script_dir"
+ ln -s "${_data_dir}/${script}" "$script_dir"
;;
*)
script="${_f%.*}"
diff --git a/ctdb/tests/shellcheck/event_scripts.sh b/ctdb/tests/shellcheck/event_scripts.sh
index b64c93649c8..dfb5ede4aba 100755
--- a/ctdb/tests/shellcheck/event_scripts.sh
+++ b/ctdb/tests/shellcheck/event_scripts.sh
@@ -4,4 +4,4 @@
define_test "event scripts"
-shellcheck_test "${CTDB_SCRIPTS_BASE}/events/"*/[0-9][0-9].*
+shellcheck_test "${CTDB_SCRIPTS_DATA_DIR}/events/"*/[0-9][0-9].*
diff --git a/ctdb/wscript b/ctdb/wscript
index 91fc0012919..d306cb67e78 100644
--- a/ctdb/wscript
+++ b/ctdb/wscript
@@ -760,8 +760,11 @@ def build(bld):
os.path.walk(path, SUBDIR_MODE_callback, pd)
return pd['file_list']
- etc_subdirs = [
+ event_script_subdirs = [
'events/legacy',
+ ]
+
+ etc_subdirs = [
'nfs-checks.d'
]
@@ -770,6 +773,13 @@ def build(bld):
else:
configdir = 'ctdb/config'
+ for t in event_script_subdirs:
+ bld.INSTALL_DIR(os.path.join(bld.env.CTDB_ETCDIR, t))
+ files = SUBDIR_MODE('%s/%s' % (configdir, t), trim_path=configdir)
+ for fmode in files:
+ bld.INSTALL_FILES(bld.env.CTDB_DATADIR, 'config/%s' % fmode[0],
+ destname=fmode[0], chmod=fmode[1])
+
for t in etc_subdirs:
files = SUBDIR_MODE('%s/%s' % (configdir, t), trim_path=configdir)
for fmode in files: