[kde-services-devel] r483 - trunk/commitfilter

josef at new.kstuff.org josef at new.kstuff.org
Sun Oct 12 19:28:37 CEST 2008


Author: josef
Date: 2008-10-12 19:28:36 +0200 (Sun, 12 Oct 2008)
New Revision: 483

Modified:
   trunk/commitfilter/TODO
   trunk/commitfilter/commitfilter.sh
Log:
- check exim filter file prior to using it
- when there is an error with it, send out warning mail, but only once per change
- fix up old differentiation between SVN and CVS repositories



Modified: trunk/commitfilter/TODO
===================================================================
--- trunk/commitfilter/TODO	2008-08-28 16:50:23 UTC (rev 482)
+++ trunk/commitfilter/TODO	2008-10-12 17:28:36 UTC (rev 483)
@@ -11,5 +11,6 @@
            [josef]        web view of filter isn't in sync with .forward (e.g. followup)
            [josef]        better user management
 (invalid?) [allen winter] escaping of directory names (e.g. kdepim-3.5.5+)
-           [pino]         it's possible to add a path multiple times, should be forbidden
+(fixed)    [pino]         it's possible to add a path multiple times, should be forbidden
+           [josef]        extra check on config file, e.g. exim4 -bf
 

Modified: trunk/commitfilter/commitfilter.sh
===================================================================
--- trunk/commitfilter/commitfilter.sh	2008-08-28 16:50:23 UTC (rev 482)
+++ trunk/commitfilter/commitfilter.sh	2008-10-12 17:28:36 UTC (rev 483)
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # Wrapper script for Commitfilter operations
-# Copyright (C) 2006 Josef Spillner <josef at kstuff.org>
+# Copyright (C) 2006 - 2008 Josef Spillner <josef at kstuff.org>
 # Published under GNU GPL conditions.
 
 # Call: commitfilter.sh generate - to generate the .forward file
@@ -12,6 +12,13 @@
 	# Update the local CVS/SVN checkout tree
 	for i in checkout/*; do
 		cd ~/$i
+		if [ -d CVS ]; then
+			cvs update -dP
+		elif [ -d .svn ]; then
+			svn up
+		else
+			true
+		fi
 		#cvs update -dP # for CVS
 		svn up # for SVN
 	done
@@ -21,7 +28,24 @@
 elif test "x$1" = "xgenerate"; then
 	# Apply all the forwarding filters
 	commitfilter > ~/.forward.tmp
-	mv ~/.forward.tmp ~/.forward
+	# See if there were any changes at all
+	diff -u ~/.forward ~/.forward.tmp >/dev/null
+	if [ $? = 1 ]; then
+		# Double-check the generated forward file
+		echo "" | /usr/sbin/exim4 -bf ~/.forward.tmp >/dev/null
+		if [ $? = 0 ]; then
+			# Replace old configuration with new one
+			mv ~/.forward.tmp ~/.forward
+		else
+			# Send out a warning mail
+			diff -u ~/.forward.tmp.last ~/.forward.tmp >/dev/null
+			if [ $? = 1 ]; then
+				cp ~/.forward.tmp ~/.forward.tmp.last
+				echo "commitfilter: invalid exim filter file" >&2
+				exit 1
+			fi
+		fi
+	fi
 else
 	echo "Syntax: commitfilter.sh update|messages|generate"
 fi



More information about the kde-services-devel mailing list