diff options
author | Martin Schwenke <martin@meltin.net> | 2018-07-07 15:58:06 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2018-07-11 11:48:39 +0200 |
commit | 8fe6a0274bdd1f40f2c38462f23ca876807f6fd9 (patch) | |
tree | d87227ec0bcba28d5ab917ef701fa0131f561d43 /ctdb/packaging | |
parent | 0937ce04222ee726a2ca7d87e3b2bf176b883340 (diff) | |
download | samba-8fe6a0274bdd1f40f2c38462f23ca876807f6fd9.tar.gz |
ctdb-packaging: Enable some standard event scripts if none are enabled
CTDB needs the legacy/00.ctdb event script to be able to function
properly. If this script is not enabled then assume a first-time
install or an upgrade to a version that requires events scripts to be
enabled via symlinks. In these cases enable this script and other
commonly used scripts.
Remove links during uninstall (but not during upgrade).
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/packaging')
-rw-r--r-- | ctdb/packaging/RPM/ctdb.spec.in | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/ctdb/packaging/RPM/ctdb.spec.in b/ctdb/packaging/RPM/ctdb.spec.in index 2aeb6c358eb..4c9cae486fd 100644 --- a/ctdb/packaging/RPM/ctdb.spec.in +++ b/ctdb/packaging/RPM/ctdb.spec.in @@ -140,10 +140,38 @@ find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \; %clean rm -rf $RPM_BUILD_ROOT +%post + +# If mandatory 00.ctdb event script is not enabled then enable it and +# some other scripts. The assumption here is that this is a +# first-time install or an upgrade to a version that requires event +# scripts to be enabled via symlinks. +required_script="00.ctdb" +required_path="%{_sysconfdir}/ctdb/events/legacy/${required_script}.script" +if [ ! -L "$required_path" ] && [ ! -e "$required_path" ] ; then + default_scripts="${required_script} + 01.reclock + 05.system + 10.interface + " + for t in $default_scripts ; do + tgt="%{_datadir}/ctdb/events/legacy/${t}.script" + name="%{_sysconfdir}/ctdb/events/legacy/${t}.script" + # Directory is created via install and files + ln -s "$tgt" "$name" + done +fi -####################################################################### -## Files section ## -####################################################################### +%preun + +# Uninstall, not upgrade. Clean up by removing any remaining links. +if [ "$1" = "0" ] ; then + for i in "%{_sysconfdir}/ctdb/events/legacy/"*.script ; do + if [ -L "$i" ] ; then + rm -f "$i" + fi + done +fi %files %defattr(-,root,root) |