From 8ef9b8fb289d287f7000c5c9f30568f76e0de94a Mon Sep 17 00:00:00 2001 From: Radek Novacek Date: Tue, 14 Jan 2014 10:29:01 +0100 Subject: spec: fix openlmi-pcp spec scripts This commit disables automatic registration of openlmi-pcp because the mof and reg files don't exist when package is installed It also adds a check if the openlmi-pcp provider is installed when uninstalling. --- openlmi-providers.spec | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'openlmi-providers.spec') diff --git a/openlmi-providers.spec b/openlmi-providers.spec index d7ba7e9..bd8d88a 100644 --- a/openlmi-providers.spec +++ b/openlmi-providers.spec @@ -837,10 +837,13 @@ fi >> %logfile 2>&1 %pre -n openlmi-pcp if [ "$1" -gt 1 ]; then - %{_bindir}/openlmi-mof-register -v %{providers_version} unregister \ - %{_datadir}/%{name}/60_LMI_PCP.mof \ - %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.mof \ - %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.reg || :; + # Only unregister when the provider was already registered + if [ -e %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.mof ]; then + %{_bindir}/openlmi-mof-register -v %{providers_version} unregister \ + %{_datadir}/%{name}/60_LMI_PCP.mof \ + %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.mof \ + %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.reg || :; + fi fi >> %logfile 2>&1 %pre -n openlmi-journald @@ -931,14 +934,6 @@ if [ "$1" -ge 1 ]; then %{_datadir}/%{name}/90_LMI_Hardware_Profile_DMTF.mof || :; fi >> %logfile 2>&1 -%post -n openlmi-pcp -if [ "$1" -ge 1 ]; then - %{_bindir}/openlmi-mof-register -v %{providers_version} register \ - %{_datadir}/%{name}/60_LMI_PCP.mof \ - %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.mof \ - %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.reg || :; -fi >> %logfile 2>&1 - %post -n openlmi-journald if [ "$1" -ge 1 ]; then %{_bindir}/openlmi-mof-register -v %{providers_version} register \ @@ -1029,10 +1024,13 @@ fi >> %logfile 2>&1 %preun -n openlmi-pcp if [ "$1" -eq 0 ]; then - %{_bindir}/openlmi-mof-register -v %{providers_version} unregister \ - %{_datadir}/%{name}/60_LMI_PCP.mof \ - %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.mof \ - %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.reg || :; + # Only unregister when the provider was already registered + if [ -e %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.mof ]; then + %{_bindir}/openlmi-mof-register -v %{providers_version} unregister \ + %{_datadir}/%{name}/60_LMI_PCP.mof \ + %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.mof \ + %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.reg || :; + fi fi >> %logfile 2>&1 %preun -n openlmi-journald -- cgit