mtd/patches patchin.sh,1.36,1.37

Artem Bityuckiy dedekind at infradead.org
Fri Dec 17 12:54:08 EST 2004


Update of /home/cvs/mtd/patches
In directory phoenix.infradead.org:/tmp/cvs-serv16408

Modified Files:
	patchin.sh 
Log Message:
Fix: dont add JFFS3-related stuff to fs/Makefile more then once.


Index: patchin.sh
===================================================================
RCS file: /home/cvs/mtd/patches/patchin.sh,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- patchin.sh	17 Dec 2004 15:12:03 -0000	1.36
+++ patchin.sh	17 Dec 2004 17:54:05 -0000	1.37
@@ -188,14 +188,22 @@
 #
 # $3:   the line which should be inserted
 #
+# Note: the $3 will be inserted only if it is absent after $2.
+#
 function patch_fs_Makefile () {
 	local INFILE=$1;
 	local PREVLINE=$2;
 	local NEWLINE=$3;
 
+	local TOTAL=`cat $INFILE | wc -l`;
+
+	# do not insert pattern if it is already present
+	if [ "x`grep "$NEWLINE" $INFILE`" != "x" ]; then
+		return 0;
+	fi;
+	
 	# determine the previous line number
 	local LINENUM='';
-	local TOTAL=`cat $INFILE | wc -l`;
 	LINENUM=`grep -m1 -n "$PREVLINE" $INFILE | sed -e 's/:.*//'`;
 	
 	# copy lines 1-LINENUM from the target file to the temporary file





More information about the linux-mtd-cvs mailing list