- fix scriptlets so they work correctly on upgrades

This commit is contained in:
Dan Horák 2019-11-27 16:57:44 +01:00
parent a47a229609
commit ad74b6ced3

View File

@ -3,7 +3,7 @@
Name: libzfcphbaapi
Summary: HBA API for the zFCP device driver
Version: 2.2.0
Release: 3%{?dist}
Release: 4%{?dist}
License: CPL
URL: http://www.ibm.com/developerworks/linux/linux390/zfcp-hbaapi.html
# http://www.ibm.com/developerworks/linux/linux390/zfcp-hbaapi-%%{hbaapiver}.html
@ -19,10 +19,8 @@ BuildRequires: libsysfs-devel
BuildRequires: sg3_utils-devel
BuildRequires: libhbaapi-devel
Requires: libhbaapi
Requires(post): grep
Requires(preun): grep sed
Provides: s390utils-libzfcphbaapi = 2:1.20.0-4
Obsoletes: s390utils-libzfcphbaapi <= 2:1.20.0-3
Requires(post): grep sed
Requires(postun): grep sed
# exclude plugin soname from Provides
%global __provides_exclude ^(libzfcphbaapi-%{version}[.]so.*)$
@ -64,13 +62,23 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}.*
%post
# remove old entry from hba.conf on upgrade
if [ $1 == 2 ]; then
grep -q -e "^libzfcphbaapi" /etc/hba.conf &&
sed -i.orig -e "/^libzfcphbaapi/d" /etc/hba.conf
fi
# add entry to hba.conf on install and upgrade (resulting in a refresh together with ^)
# the grep ensures there won't be a duplicate entry after reinstall
grep -q -e "^libzfcphbaapi" /etc/hba.conf ||
echo "libzfcphbaapi %{_libdir}/libzfcphbaapi-%{version}.so" >> /etc/hba.conf
:
%preun
grep -q -e "^libzfcphbaapi" /etc/hba.conf &&
sed -i.orig -e "/^libzfcphbaapi/d" /etc/hba.conf
%postun
# remove entry from hba.conf on uninstall
if [ $1 == 0 ]; then
grep -q -e "^libzfcphbaapi" /etc/hba.conf &&
sed -i.orig -e "/^libzfcphbaapi/d" /etc/hba.conf
fi
:
@ -93,6 +101,9 @@ grep -q -e "^libzfcphbaapi" /etc/hba.conf &&
%changelog
* Wed Nov 27 2019 Dan Horák <dan[at]danny.cz> - 2.2.0-4
- fix scriptlets so they work correctly on upgrades
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild