[BackupPC] - fix postun scriptlet error (bz #736946) - make postun scriptlet more coherent

Bernard Johnson bjohnson at fedoraproject.org
Tue Sep 20 03:03:13 UTC 2011


commit edd69b6cb6ccbf3eeb339ddf9bdde17d8debb56b
Author: Bernard Johnson <bjohnson at symetrix.com>
Date:   Mon Sep 19 21:02:42 2011 -0600

    - fix postun scriptlet error (bz #736946)
    - make postun scriptlet more coherent

 BackupPC.spec |   49 +++++++++++++++++++++++++++++--------------------
 1 files changed, 29 insertions(+), 20 deletions(-)
---
diff --git a/BackupPC.spec b/BackupPC.spec
index e0d7ca4..94ee0cd 100644
--- a/BackupPC.spec
+++ b/BackupPC.spec
@@ -12,9 +12,11 @@
 %global _with_systemd 1
 %endif
 
+%global _updatedb_conf /etc/updatedb.conf
+
 Name:           BackupPC
 Version:        3.2.1
-Release:        4%{?dist}
+Release:        6%{?dist}
 Summary:        High-performance backup system
 
 Group:          Applications/System
@@ -254,37 +256,40 @@ fi
 
 
 # add BackupPC backup directories to PRUNEPATHS in locate database
-UPDATEDB=/etc/updatedb.conf
-if [ -w $UPDATEDB ]; then
-  grep ^PRUNEPATHS $UPDATEDB | grep %{_sharedstatedir}/%{name} > /dev/null
+if [ -w %{_updatedb_conf} ]; then
+  grep ^PRUNEPATHS %{_updatedb_conf} | grep %{_sharedstatedir}/%{name} > /dev/null
   if [ $? -eq 1 ]; then
-    sed -i '\@PRUNEPATHS at s@"$@ '%{_sharedstatedir}/%{name}'"@' $UPDATEDB
+    sed -i '\@PRUNEPATHS at s@"$@ '%{_sharedstatedir}/%{name}'"@' %{_updatedb_conf}
   fi
 fi
+:
 
 %postun
+# clear out any BackupPC configuration in apache
 service httpd condrestart > /dev/null 2>&1 || :
-%if ! 0%{?_without_selinux}
-if [ "$1" -eq "0" ]; then
-     (
-     # Remove the SElinux policy.
-     semodule -r %{name} || :
-     )&>/dev/null
-
-    # remove BackupPC backup directories from PRUNEPATHS in locate database
-    if [ -w $UPDATEDB ]; then
-      sed -i '\@PRUNEPATHS at s@[ ]*'%{_sharedstatedir}/%{name}'@@' $UPDATEDB
-    fi
+
+if [ $1 -eq 0 ]; then
+  # uninstall
+  %if ! 0%{?_without_selinux}
+  # Remove the SElinux policy.
+  semodule -r %{name} &> /dev/null || :
+  %endif
+
+  # remove BackupPC backup directories from PRUNEPATHS in locate database
+  if [ -w %{_updatedb_conf} ]; then
+    sed -i '\@PRUNEPATHS at s@[ ]*'%{_sharedstatedir}/%{name}'@@' %{_updatedb_conf} || :
+  fi
 fi
-%endif
-if [ $1 -ge 1 ]; then
-  # Package upgrade, not uninstall
+
+if [ $1 -eq 1 ]; then
+  # package upgrade, not uninstall
   %if 0%{?_with_systemd}
   /bin/systemctl try-restart backuppc.service > /dev/null 2>&1 || :  
   %endif
+  # at least one command required
+  :
 fi
 
-
 %files
 %defattr(-,root,root,-)
 %doc README README.fedora ChangeLog LICENSE doc/
@@ -321,6 +326,10 @@ fi
 %endif
 
 %changelog
+* Mon Sep 19 2011 Bernard Johnson <bjohnson at symetrix.com> - 3.2.1-5
+- fix postun scriptlet error (bz #736946)
+- make postun scriptlet more coherent
+
 * Fri Aug 12 2011 Bernard Johnson <bjohnson at symetrix.com> - 3.2.1-4
 - change macro conditionals to include tmpfiles.d support starting at
   Fedora 15 (bz #730053)


More information about the scm-commits mailing list