introduce the new systemd-rpm macros
This commit is contained in:
parent
9581e6bc50
commit
c6e393e57b
93
sanlock.spec
93
sanlock.spec
@ -1,6 +1,18 @@
|
|||||||
|
%define with_systemd 0%{!?_without_systemd:0}
|
||||||
|
|
||||||
|
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
|
||||||
|
%define with_systemd 1
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
|
||||||
|
%define with_systemd_macros 1
|
||||||
|
%else
|
||||||
|
%define with_systemd_macros 0
|
||||||
|
%endif
|
||||||
|
|
||||||
Name: sanlock
|
Name: sanlock
|
||||||
Version: 2.7
|
Version: 2.7
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: A shared disk lock manager
|
Summary: A shared disk lock manager
|
||||||
|
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
@ -8,7 +20,7 @@ License: GPLv2 and GPLv2+ and LGPLv2+
|
|||||||
URL: https://fedorahosted.org/sanlock/
|
URL: https://fedorahosted.org/sanlock/
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
BuildRequires: libblkid-devel libaio-devel python python-devel
|
BuildRequires: libblkid-devel libaio-devel python python-devel
|
||||||
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
|
%if %{with_systemd}
|
||||||
BuildRequires: systemd-units
|
BuildRequires: systemd-units
|
||||||
%endif
|
%endif
|
||||||
%if 0%{?rhel} >= 6
|
%if 0%{?rhel} >= 6
|
||||||
@ -17,6 +29,12 @@ ExclusiveArch: x86_64
|
|||||||
Requires: %{name}-lib = %{version}-%{release}
|
Requires: %{name}-lib = %{version}-%{release}
|
||||||
Requires(pre): /usr/sbin/groupadd
|
Requires(pre): /usr/sbin/groupadd
|
||||||
Requires(pre): /usr/sbin/useradd
|
Requires(pre): /usr/sbin/useradd
|
||||||
|
%if %{with_systemd}
|
||||||
|
Requires(post): systemd-units
|
||||||
|
Requires(post): systemd-sysv
|
||||||
|
Requires(preun): systemd-units
|
||||||
|
Requires(postun): systemd-units
|
||||||
|
%endif
|
||||||
Source0: http://git.fedorahosted.org/cgit/sanlock.git/snapshot/%{name}-%{version}.tar.gz
|
Source0: http://git.fedorahosted.org/cgit/sanlock.git/snapshot/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
#Patch0: foo.patch
|
#Patch0: foo.patch
|
||||||
@ -53,7 +71,8 @@ make -C fence_sanlock \
|
|||||||
install LIBDIR=%{_libdir} \
|
install LIBDIR=%{_libdir} \
|
||||||
DESTDIR=$RPM_BUILD_ROOT
|
DESTDIR=$RPM_BUILD_ROOT
|
||||||
|
|
||||||
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
|
|
||||||
|
%if %{with_systemd}
|
||||||
install -D -m 0755 init.d/sanlock $RPM_BUILD_ROOT/lib/systemd/systemd-sanlock
|
install -D -m 0755 init.d/sanlock $RPM_BUILD_ROOT/lib/systemd/systemd-sanlock
|
||||||
install -D -m 0644 init.d/sanlock.service $RPM_BUILD_ROOT/%{_unitdir}/sanlock.service
|
install -D -m 0644 init.d/sanlock.service $RPM_BUILD_ROOT/%{_unitdir}/sanlock.service
|
||||||
install -D -m 0755 init.d/wdmd $RPM_BUILD_ROOT/lib/systemd/systemd-wdmd
|
install -D -m 0755 init.d/wdmd $RPM_BUILD_ROOT/lib/systemd/systemd-wdmd
|
||||||
@ -92,44 +111,65 @@ getent passwd sanlock > /dev/null || /usr/sbin/useradd \
|
|||||||
/usr/sbin/usermod -a -G disk sanlock
|
/usr/sbin/usermod -a -G disk sanlock
|
||||||
|
|
||||||
%post
|
%post
|
||||||
if [ $1 -eq 1 ] ; then
|
%if %{with_systemd}
|
||||||
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
|
%if %{with_systemd_macros}
|
||||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
%systemd_post wdmd.service sanlock.service
|
||||||
%else
|
%else
|
||||||
|
if [ $1 -eq 1 ] ; then
|
||||||
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||||
|
fi
|
||||||
|
%endif
|
||||||
|
%else
|
||||||
|
if [ $1 -eq 1 ] ; then
|
||||||
/sbin/chkconfig --add sanlock
|
/sbin/chkconfig --add sanlock
|
||||||
/sbin/chkconfig --add wdmd
|
/sbin/chkconfig --add wdmd
|
||||||
%endif
|
|
||||||
fi
|
fi
|
||||||
|
%endif
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
if [ $1 = 0 ]; then
|
%if %{with_systemd}
|
||||||
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
|
%if %{with_systemd_macros}
|
||||||
/bin/systemctl --no-reload sanlock.service > /dev/null 2>&1 || :
|
%systemd_preun sanlock.service
|
||||||
/bin/systemctl --no-reload wdmd.service > /dev/null 2>&1 || :
|
%systemd_preun wdmd.service
|
||||||
/bin/systemctl stop sanlock.service > /dev/null 2>&1 || :
|
|
||||||
/bin/systemctl stop wdmd.service > /dev/null 2>&1 || :
|
|
||||||
%else
|
%else
|
||||||
/sbin/service sanlock stop > /dev/null 2>&1
|
if [ $1 = 0 ]; then
|
||||||
/sbin/service wdmd stop > /dev/null 2>&1
|
/bin/systemctl --no-reload disable sanlock.service > /dev/null 2>&1 || :
|
||||||
/sbin/chkconfig --del sanlock
|
/bin/systemctl stop sanlock.service > /dev/null 2>&1 || :
|
||||||
/sbin/chkconfig --del wdmd
|
/bin/systemctl --no-reload disable wdmd.service > /dev/null 2>&1 || :
|
||||||
%endif
|
/bin/systemctl stop wdmd.service > /dev/null 2>&1 || :
|
||||||
fi
|
fi
|
||||||
|
%endif
|
||||||
|
%else
|
||||||
|
if [ $1 = 0 ]; then
|
||||||
|
/sbin/service sanlock stop > /dev/null 2>&1
|
||||||
|
/sbin/chkconfig --del sanlock
|
||||||
|
/sbin/service wdmd stop > /dev/null 2>&1
|
||||||
|
/sbin/chkconfig --del wdmd
|
||||||
|
fi
|
||||||
|
%endif
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
|
%if %{with_systemd}
|
||||||
|
%if %{with_systemd_macros}
|
||||||
|
%systemd_postun_with_restart sanlock.service
|
||||||
|
%systemd_postun_with_restart wdmd.service
|
||||||
|
%else
|
||||||
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||||
if [ $1 -ge 1 ] ; then
|
if [ $1 -ge 1 ] ; then
|
||||||
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
|
|
||||||
/bin/systemctl try-restart sanlock.service >/dev/null 2>&1 || :
|
/bin/systemctl try-restart sanlock.service >/dev/null 2>&1 || :
|
||||||
/bin/systemctl try-restart wdmd.service >/dev/null 2>&1 || :
|
/bin/systemctl try-restart wdmd.service >/dev/null 2>&1 || :
|
||||||
|
fi
|
||||||
|
%endif
|
||||||
%else
|
%else
|
||||||
|
if [ $1 -ge 1 ] ; then
|
||||||
/sbin/service sanlock condrestart >/dev/null 2>&1 || :
|
/sbin/service sanlock condrestart >/dev/null 2>&1 || :
|
||||||
/sbin/service wdmd condrestart >/dev/null 2>&1 || :
|
/sbin/service wdmd condrestart >/dev/null 2>&1 || :
|
||||||
%endif
|
|
||||||
fi
|
fi
|
||||||
|
%endif
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
|
%if %{with_systemd}
|
||||||
/lib/systemd/systemd-sanlock
|
/lib/systemd/systemd-sanlock
|
||||||
/lib/systemd/systemd-wdmd
|
/lib/systemd/systemd-wdmd
|
||||||
%{_unitdir}/sanlock.service
|
%{_unitdir}/sanlock.service
|
||||||
@ -215,7 +255,7 @@ daemon for using sanlock and wdmd as a cluster fence agent.
|
|||||||
|
|
||||||
%files -n fence-sanlock
|
%files -n fence-sanlock
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
|
%if %{with_systemd}
|
||||||
/lib/systemd/systemd-fence_sanlockd
|
/lib/systemd/systemd-fence_sanlockd
|
||||||
%{_unitdir}/fence_sanlockd.service
|
%{_unitdir}/fence_sanlockd.service
|
||||||
%else
|
%else
|
||||||
@ -229,7 +269,7 @@ daemon for using sanlock and wdmd as a cluster fence agent.
|
|||||||
|
|
||||||
%post -n fence-sanlock
|
%post -n fence-sanlock
|
||||||
if [ $1 -eq 1 ] ; then
|
if [ $1 -eq 1 ] ; then
|
||||||
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
|
%if %{with_systemd}
|
||||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||||
%else
|
%else
|
||||||
/sbin/chkconfig --add fence_sanlockd
|
/sbin/chkconfig --add fence_sanlockd
|
||||||
@ -239,7 +279,7 @@ fi
|
|||||||
|
|
||||||
%preun -n fence-sanlock
|
%preun -n fence-sanlock
|
||||||
if [ $1 = 0 ]; then
|
if [ $1 = 0 ]; then
|
||||||
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
|
%if %{with_systemd}
|
||||||
/bin/systemctl --no-reload fence_sanlockd.service > /dev/null 2>&1 || :
|
/bin/systemctl --no-reload fence_sanlockd.service > /dev/null 2>&1 || :
|
||||||
%else
|
%else
|
||||||
/sbin/service fence_sanlockd stop > /dev/null 2>&1
|
/sbin/service fence_sanlockd stop > /dev/null 2>&1
|
||||||
@ -249,7 +289,7 @@ fi
|
|||||||
|
|
||||||
%postun -n fence-sanlock
|
%postun -n fence-sanlock
|
||||||
if [ $1 -ge 1 ] ; then
|
if [ $1 -ge 1 ] ; then
|
||||||
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
|
%if %{with_systemd}
|
||||||
/bin/systemctl try-restart fence_sanlockd.service > /dev/null 2>&1 || :
|
/bin/systemctl try-restart fence_sanlockd.service > /dev/null 2>&1 || :
|
||||||
%else
|
%else
|
||||||
/sbin/service fence_sanlockd condrestart >/dev/null 2>&1 || :
|
/sbin/service fence_sanlockd condrestart >/dev/null 2>&1 || :
|
||||||
@ -257,6 +297,9 @@ if [ $1 -ge 1 ] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Apr 2 2013 Federico Simoncelli <fsimonce@redhat.com> - 2.7-2
|
||||||
|
- introduce the new systemd-rpm macros (#857397)
|
||||||
|
|
||||||
* Wed Mar 06 2013 David Teigland <teigland@redhat.com> - 2.7-1
|
* Wed Mar 06 2013 David Teigland <teigland@redhat.com> - 2.7-1
|
||||||
- Update to sanlock-2.7
|
- Update to sanlock-2.7
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user