Use new systemd macros (BZ 850185)
ref. https://bugzilla.redhat.com/show_bug.cgi?id=850185 Signed-off-by: Tony Asleson <tasleson@redhat.com>
This commit is contained in:
parent
0dd3a1e7ac
commit
d2e8d49442
@ -1,12 +1,4 @@
|
||||
%bcond_without rest_api
|
||||
|
||||
%if 0%{?rhel} <= 6
|
||||
%global with_rest_api 0
|
||||
# RHEL 6 does not have libmicrohttpd in main repo, but in EPEL repo
|
||||
# Hence we disable REST API daemon compiling.
|
||||
# If EPEL6 is enabled, please use:
|
||||
# rpmbuild -ba libstoragemgmt.spec --with rest_api
|
||||
%endif
|
||||
%bcond_with rest_api
|
||||
|
||||
%{?_with_rest_api:
|
||||
%global with_rest_api 1
|
||||
@ -32,15 +24,11 @@ BuildRequires: glib2-devel
|
||||
# Explicitly require gcc-c++
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: PyYAML
|
||||
|
||||
|
||||
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
|
||||
BuildRequires: systemd-units
|
||||
BuildRequires: systemd
|
||||
Requires: initscripts
|
||||
Requires(post): systemd-units
|
||||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
%endif
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
|
||||
%description
|
||||
The libStorageMgmt library will provide a vendor agnostic open source storage
|
||||
@ -158,7 +146,6 @@ rm -rf %{buildroot}
|
||||
make install DESTDIR=%{buildroot}
|
||||
find %{buildroot} -name '*.la' -exec rm -f {} ';'
|
||||
|
||||
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
|
||||
install -d -m755 %{buildroot}/%{_unitdir}
|
||||
install -m644 packaging/daemon/libstoragemgmt.service \
|
||||
%{buildroot}/%{_unitdir}/libstoragemgmt.service
|
||||
@ -167,12 +154,6 @@ install -m644 packaging/daemon/libstoragemgmt.service \
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/tmpfiles.d
|
||||
install -m 0644 packaging/daemon/lsm-tmpfiles.conf \
|
||||
%{buildroot}%{_sysconfdir}/tmpfiles.d/%{name}.conf
|
||||
%else
|
||||
#Need these to exist at install so we can start the daemon
|
||||
mkdir -p %{buildroot}/etc/rc.d/init.d
|
||||
install packaging/daemon/libstoragemgmtd \
|
||||
%{buildroot}/etc/rc.d/init.d/libstoragemgmtd
|
||||
%endif
|
||||
|
||||
#Need these to exist at install so we can start the daemon
|
||||
mkdir -p %{buildroot}%{_localstatedir}/run/lsm/ipc
|
||||
@ -201,59 +182,23 @@ getent passwd libstoragemgmt >/dev/null || \
|
||||
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
if [ $1 -eq 1 ]; then
|
||||
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
|
||||
/bin/systemctl enable libstoragemgmt.service >/dev/null 2>&1 || :
|
||||
%else
|
||||
/sbin/chkconfig --add libstoragemgmtd
|
||||
%endif
|
||||
fi
|
||||
%systemd_post libstoragemgmt.service
|
||||
|
||||
|
||||
%if 0%{?with_rest_api}
|
||||
%preun rest
|
||||
if [ $1 -eq 0 ]; then
|
||||
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
|
||||
# On uninstall (not upgrade), disable and stop the units
|
||||
/bin/systemctl --no-reload disable \
|
||||
libstoragemgmt-rest.service >/dev/null 2>&1 || :
|
||||
/bin/systemctl stop libstoragemgmt-rest.service >/dev/null 2>&1 || :
|
||||
%endif
|
||||
fi
|
||||
%systemd_preun libstoragemgmt-rest.service
|
||||
|
||||
%postun rest
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
if [ $1 -ge 1 ] ; then
|
||||
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
|
||||
# On upgrade (not uninstall), optionally, restart the daemon
|
||||
/bin/systemctl try-restart libstoragemgmt-rest.service >/dev/null 2>&1 || :
|
||||
%endif
|
||||
fi
|
||||
%systemd_postun libstoragemgmt-rest.service
|
||||
%endif
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ]; then
|
||||
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
|
||||
# On uninstall (not upgrade), disable and stop the units
|
||||
/bin/systemctl --no-reload disable libstoragemgmt.service >/dev/null 2>&1 || :
|
||||
/bin/systemctl stop libstoragemgmt.service >/dev/null 2>&1 || :
|
||||
%else
|
||||
/etc/rc.d/init.d/libstoragemgmtd stop > /dev/null 2>&1 || :
|
||||
/sbin/chkconfig --del libstoragemgmtd
|
||||
%endif
|
||||
fi
|
||||
%systemd_preun libstoragemgmt.service
|
||||
|
||||
%postun
|
||||
/sbin/ldconfig
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
if [ $1 -ge 1 ] ; then
|
||||
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
|
||||
# On upgrade (not uninstall), optionally, restart the daemon
|
||||
/bin/systemctl try-restart libstoragemgmt.service >/dev/null 2>&1 || :
|
||||
%else
|
||||
#Restart the daemond
|
||||
/etc/rc.d/init.d/libstoragemgmtd restart >/dev/null 2>&1 || :
|
||||
%endif
|
||||
fi
|
||||
%systemd_postun libstoragemgmt.service
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
@ -268,18 +213,12 @@ fi
|
||||
%{python_sitelib}/lsm/lsmcli/data_display.*
|
||||
%{python_sitelib}/lsm/lsmcli/cmdline.*
|
||||
|
||||
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
|
||||
%{_unitdir}/*
|
||||
%endif
|
||||
|
||||
%dir %attr(0755, libstoragemgmt, libstoragemgmt) %{_localstatedir}/run/lsm/
|
||||
%dir %attr(0755, libstoragemgmt, libstoragemgmt) %{_localstatedir}/run/lsm/ipc
|
||||
|
||||
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
|
||||
%attr(0644, root, root) %{_sysconfdir}/tmpfiles.d/%{name}.conf
|
||||
%else
|
||||
%attr(0755, root, root) /etc/rc.d/init.d/libstoragemgmtd
|
||||
%endif
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
@ -342,10 +281,8 @@ fi
|
||||
%files rest
|
||||
%defattr(-,root,root,-)
|
||||
%{_bindir}/lsm_restd
|
||||
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
|
||||
%{_unitdir}/libstoragemgmt-rest.service
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Sun Sep 7 2014 Tony Asleson <tasleson@redhat.com> - 1.0.0-1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user