From cc050fd49915b76570fe4231b4965a51189a787c Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Tue, 2 Feb 2021 05:01:30 +0900 Subject: [PATCH] dist/redhat: stop using systemd macros, call systemctl directly Fedora version of systemd macros does not work correctly on CentOS7, since CentOS7 does not support "file trigger" feature. To fix the issue we need to stop using systemd macros, call systemctl directly. See scylladb/scylla-jmx#94 Closes #8005 (cherry picked from commit 7b310c591e20981adb5ac66bc6db5cf1f18b8fcb) --- dist/redhat/scylla.spec | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/dist/redhat/scylla.spec b/dist/redhat/scylla.spec index 373898529b..dc1bd52afa 100644 --- a/dist/redhat/scylla.spec +++ b/dist/redhat/scylla.spec @@ -78,13 +78,18 @@ getent passwd scylla || /usr/sbin/useradd -g scylla -s /sbin/nologin -r -d %{_sh %post server /opt/scylladb/scripts/scylla_post_install.sh -%systemd_post scylla-server.service +if [ $1 -eq 1 ] ; then + /usr/bin/systemctl preset scylla-server.service ||: +fi %preun server -%systemd_preun scylla-server.service +if [ $1 -eq 0 ] ; then + /usr/bin/systemctl --no-reload disable scylla-server.service ||: + /usr/bin/systemctl stop scylla-server.service ||: +fi %postun server -%systemd_postun scylla-server.service +/usr/bin/systemctl daemon-reload ||: %posttrans server if [ -d /tmp/%{name}-%{version}-%{release} ]; then @@ -223,10 +228,18 @@ URL: https://github.com/prometheus/node_exporter Prometheus exporter for machine metrics, written in Go with pluggable metric collectors. %post node-exporter -%systemd_post node-exporter.service +if [ $1 -eq 1 ] ; then + /usr/bin/systemctl preset node-exporter.service ||: +fi %preun node-exporter -%systemd_preun node-exporter.service +if [ $1 -eq 0 ] ; then + /usr/bin/systemctl --no-reload disable node-exporter.service ||: + /usr/bin/systemctl stop node-exporter.service ||: +fi + +%postun node-exporter +/usr/bin/systemctl daemon-reload ||: %files node-exporter %defattr(-,root,root)