More systemd and sysv init script tweaks

Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
Doug Ledford 2012-12-05 12:57:11 -05:00
parent dbba8402d3
commit 469a0f1e18

View File

@ -1,6 +1,6 @@
Name: opensm
Version: 3.3.15
Release: 1%{?dist}
Release: 2%{?dist}
Summary: OpenIB InfiniBand Subnet Manager and management utilities
Group: System Environment/Daemons
License: GPLv2 or BSD
@ -16,6 +16,9 @@ Patch0: opensm-3.3.13-prefix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libibmad-devel = 1.3.9, libtool, bison, flex, byacc, systemd
Requires: %{name}-libs = %{version}-%{release}, logrotate, rdma
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
ExcludeArch: s390 s390x
%description
@ -29,8 +32,8 @@ running the opensm daemon.
%package sysv
Summary: Old back compatible SysV init script
Group: System Environment/Daemons
Requires(post): chkconfig, service
Requires(preun): chkconfig, service
Requires(post): chkconfig, /sbin/service
Requires(preun): chkconfig, /sbin/service
%description sysv
OpenSM has been updated to use the new systemd daemon management
@ -86,6 +89,23 @@ mkdir -p ${RPM_BUILD_ROOT}/var/cache/opensm
%clean
rm -rf %{buildroot}
%post
%systemd_post opensm.service
%preun
# Don't use the macro because we need to remove our cache directory as well
# and the macro doesn't have the ability to do that. But, here the macro
# is for future reference:
# %systemd_preun opensm.service
if [ $1 = 0 ]; then
/bin/systemctl --no-reload disable opensm.service >/dev/null 2>&1 || :
/bin/systemctl stop opensm.service >/dev/null 2>&1 || :
rm -fr /var/cache/opensm
fi
%postun
%systemd_postun_with_restart opensm.service
%post sysv
if [ $1 = 1 ]; then
/sbin/chkconfig --add opensm
@ -97,9 +117,9 @@ fi
if [ $1 = 0 ]; then
/sbin/service opensm stop
/sbin/chkconfig --del opensm
rm -f /var/cache/opensm/*
fi
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
@ -134,6 +154,10 @@ fi
%{_libdir}/lib*.a
%changelog
* Wed Dec 05 2012 Doug Ledford <dledford@redhat.com> - 3.3.15-2
- More tweaks to systemd setup (proper scriptlets now)
- More tweaks to old sysv init script support (fix Requires)
* Tue Nov 27 2012 Doug Ledford <dledford@redhat.com> - 3.3.15-1
- Update to latest upstream release
- Update to systemd startup