[Logcheck-commits] CVS logcheck/debian

CVS User maks-guest logcheck-devel@lists.alioth.debian.org
Fri, 13 May 2005 11:16:02 +0000


Update of /cvsroot/logcheck/logcheck/debian
In directory haydn:/tmp/cvs-serv26116/debian

Modified Files:
	changelog logcheck.postinst 
Log Message:

beautify logcheck.postinst, should make intents clearer.
bonus speeds up things on install as fewer calls to dpkg.


--- /cvsroot/logcheck/logcheck/debian/changelog	2005/05/12 16:19:56	1.430
+++ /cvsroot/logcheck/logcheck/debian/changelog	2005/05/13 11:16:02	1.431
@@ -44,6 +44,7 @@
   * Update rsync daemon rule thanks Paul Slootman <paul@debian.org> 
     (Closes: #308800)
   * Update postfix peer verification rule match. (Closes: #307889)
+  * Beautify logcheck.postinst don't call dpkg --compare-versions when no $2.
 
  -- 
 
--- /cvsroot/logcheck/logcheck/debian/logcheck.postinst	2005/04/30 06:53:24	1.36
+++ /cvsroot/logcheck/logcheck/debian/logcheck.postinst	2005/05/13 11:16:02	1.37
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# $Id: logcheck.postinst,v 1.36 2005/04/30 06:53:24 maks-guest Exp $
+# $Id: logcheck.postinst,v 1.37 2005/05/13 11:16:02 maks-guest Exp $
 
 set -e
 
@@ -43,31 +43,30 @@
 	fi  
 
 	# Remove old directory
-	if dpkg --compare-versions "$2" lt "1.1.1-13.2"; then
+	if [ ! -n "$2" ] || dpkg --compare-versions "$2" lt "1.1.1-13.2"; then
 	    if [ -d /var/cache/logcheck ]; then
 		rm -fr /var/cache/logcheck
 	    fi
 	fi
 	# Remove unused old directory
-	if dpkg --compare-versions "$2" lt "1.2.25"; then
+	if [ ! -n "$2" ] || dpkg --compare-versions "$2" lt "1.2.25"; then
 	    if [ -d /var/state/logcheck ]; then
 		rm -fr /var/state/logcheck
 	    fi
 	fi
-        if [ "$2" = "" -a ! -f /etc/logcheck/header.txt ]; then
+        if [ ! -n "$2" ] && [ ! -f /etc/logcheck/header.txt ]; then
           cp -p /usr/share/logcheck/header.txt /etc/logcheck
         fi
 
-	if dpkg --compare-versions "$2" lt "1.2.39"; then
+	if [ ! -n "$2" ] || dpkg --compare-versions "$2" lt "1.2.39"; then
           chown -R logcheck:logcheck /var/lock/logcheck || true
         fi
 
 	# need to be done on install and on upgrade for new rule files
 	chgrp -R logcheck /etc/logcheck || true
 
-	# This gets executed even if there is no $2.
-	if dpkg --compare-versions "$2" lt "1.2.34"; then
-    	  # Fix Permissions
+    	# Fix Permissions
+	if [ ! -n "$2" ] || dpkg --compare-versions "$2" lt "1.2.34"; then
     	  chown -R logcheck:logcheck /var/lib/logcheck  || true
           chmod 2750 /etc/logcheck/ignore.d.paranoid || true
           chmod 2750 /etc/logcheck/ignore.d.workstation || true