dist/redhat: override systemd macros to CentOS7 version

Fedora 31 version of systemd macros does not work correctly on CentOS7,
since CentOS7 does not support "file trigger" feature.
Even after 05d4378, scriptlets on old scylla .rpm and new scylla .rpm is
not completely same.

To fix the issue we need to override macros with CentOS7 version.

Fixes #94
This commit is contained in:
Takuya ASADA 2020-01-17 04:36:24 +09:00
parent 29601254fc
commit 6db93837dd
3 changed files with 23 additions and 1 deletions

View File

@ -69,6 +69,7 @@ RPMBUILD=$(readlink -f ../)
mkdir -p $RPMBUILD/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
ln -fv $RELOC_PKG $RPMBUILD/SOURCES/
ln -fv dist/redhat/systemd.inc $RPMBUILD/SOURCES/
pystache dist/redhat/scylla-jmx.spec.mustache "{ \"version\": \"$SCYLLA_VERSION\", \"release\": \"$SCYLLA_RELEASE\", \"product\": \"$PRODUCT\", \"$PRODUCT\": true }" > $RPMBUILD/SPECS/scylla-jmx.spec
# this rpm can be install on both fedora / centos7, so drop distribution name from the file name

View File

@ -7,6 +7,7 @@ Group: Applications/Databases
License: AGPLv3
URL: http://www.scylladb.com/
Source0: scylla-jmx-package.tar.gz
Source1: systemd.inc
BuildArch: noarch
BuildRequires: systemd-units
@ -14,6 +15,8 @@ BuildRequires: pystache
%{?rhel:BuildRequires: python-setuptools}
Requires: {{product}}-server java-1.8.0-openjdk-headless
%include %{SOURCE1}
%description
@ -41,7 +44,6 @@ fi
%post
%systemd_post scylla-jmx.service
/usr/bin/systemctl daemon-reload ||:
%preun
%systemd_preun scylla-jmx.service

19
dist/redhat/systemd.inc vendored Normal file
View File

@ -0,0 +1,19 @@
%define systemd_daemon_reload \
if [ -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl daemon-reload ||: \
fi \
%{nil}
%undefine systemd_post
%define systemd_post() %{expand:%systemd_daemon_reload}
%undefine systemd_preun
%define systemd_preun() \
if [ $1 -eq 0 ] && [ -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl disable %1 ||: \
/usr/bin/systemctl stop %1 ||: \
fi \
%{nil}
%undefine systemd_postun
%define systemd_postun() %{expand:%systemd_daemon_reload}