From: Martin Schwenke Date: Sat, 7 Jul 2018 05:58:06 +0000 (+1000) Subject: ctdb-packaging: Enable some standard event scripts if none are enabled X-Git-Tag: tevent-0.9.37~32 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8fe6a0274bdd1f40f2c38462f23ca876807f6fd9;p=thirdparty%2Fsamba.git 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 Reviewed-by: Amitay Isaacs --- 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)