[bash] erase /bin/bash and /bin/sh in postun only if we are uninstalling (#752827)

Roman Rakus rrakus at fedoraproject.org
Thu Nov 10 15:32:01 UTC 2011


commit 41cf2beca6d73c2da65095e580660e7a4af07f96
Author: Roman Rakus <rrakus at redhat.com>
Date:   Thu Nov 10 16:31:31 2011 +0100

    erase /bin/bash and /bin/sh in postun only if we are uninstalling (#752827)
    
    Signed-off-by: Roman Rakus <rrakus at redhat.com>

 bash.spec |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/bash.spec b/bash.spec
index 0f2282b..d52cd57 100644
--- a/bash.spec
+++ b/bash.spec
@@ -6,7 +6,7 @@
 Version: %{baseversion}%{patchleveltag}
 Name: bash
 Summary: The GNU Bourne Again shell
-Release: 6%{?dist}
+Release: 7%{?dist}
 Group: System Environment/Shells
 License: GPLv3+
 Url: http://www.gnu.org/software/bash
@@ -262,19 +262,23 @@ if f then
 end
 
 %postun -p <lua>
-t={}
-for line in io.lines("/etc/shells")
-do
-  if line ~= "/bin/bash" and line ~= "/bin/sh"
-  then
-    table.insert(t,line)
+-- Run it only if we are uninstalling
+if arg[2] == "0"
+then
+  t={}
+  for line in io.lines("/etc/shells")
+  do
+    if line ~= "/bin/bash" and line ~= "/bin/sh"
+    then
+      table.insert(t,line)
+    end
   end
-end
 
-f = io.open("/etc/shells", "w+")
-for n,line in pairs(t)
-do
-  f:write(line.."\n")
+  f = io.open("/etc/shells", "w+")
+  for n,line in pairs(t)
+  do
+    f:write(line.."\n")
+  end
 end
 
 %files -f %{name}.lang
@@ -296,6 +300,9 @@ end
 #%doc doc/*.ps doc/*.0 doc/*.html doc/article.txt
 
 %changelog
+* Thu Nov 10 2011 Roman Rakus <rrakus at redhat.com> - 4.2.10-7
+- erase /bin/bash and /bin/sh in postun only if we are uninstalling (#752827)
+
 * Mon Nov 07 2011 Roman Rakus <rrakus at redhat.com> - 4.2.10-6
 - Simplified lua post script (#740611)
 


More information about the scm-commits mailing list