mtd/patches patchin.sh,1.35,1.36

havasi at infradead.org havasi at infradead.org
Fri Dec 17 10:12:06 EST 2004


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

Modified Files:
	patchin.sh 
Log Message:

Change a sed parameter from 0 to 1. It does the same but works with 
GNU sed version 4.1.2, too.

For JFFS3 add the patching of fs/Makefile.



Index: patchin.sh
===================================================================
RCS file: /home/cvs/mtd/patches/patchin.sh,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- patchin.sh	13 Dec 2004 12:59:58 -0000	1.35
+++ patchin.sh	17 Dec 2004 15:12:03 -0000	1.36
@@ -91,9 +91,9 @@
 		let MENULINE=$TOTALOUT;
 	fi;
 	
-	# copy lines 0-MENULINE from the target file to the temporary file
+	# copy lines 1-MENULINE from the target file to the temporary file
 	TMPFILE="Kconfig.$$";
-	sed -n "$OUTFILE" -e "0,$MENULINE p" > $TMPFILE;
+	sed -n "$OUTFILE" -e "1,$MENULINE p" > $TMPFILE;
 	echo >> $TMPFILE;
 	# append our lines
 	sed -n "$INFILE" -e "$FIRSTLINE,$LASTLINE p" >> $TMPFILE;
@@ -178,6 +178,41 @@
 }
 
 #
+# Patch the fs/Makfile file.
+# 
+# Function requires the following positional parameters:
+# 
+# $1:   the path of the Makefile
+#
+# $2:   pattern of the previous line, after it the third parameter will be inserted
+#
+# $3:   the line which should be inserted
+#
+function patch_fs_Makefile () {
+	local INFILE=$1;
+	local PREVLINE=$2;
+	local NEWLINE=$3;
+
+	# 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
+	TMPFILE="Makefile.$$";
+	sed -n "$INFILE" -e "1,$LINENUM p" > $TMPFILE;
+	echo "$NEWLINE" >> $TMPFILE;
+	let LINENUM=$LINENUM+1;
+	
+	sed -n "$INFILE" -e "$LINENUM,$TOTAL p" >> $TMPFILE;
+	# replace the target file by the temporary which now contains our entries
+	mv $TMPFILE $INFILE;
+
+	return 0;
+}
+
+
+#
 # Patch old kernels with JFFS/JFFS2 filesystems
 # 
 function legacy_fs_patch () {
@@ -571,6 +606,7 @@
 	patchit;
 	
 	patch_Kconfig "$TOPDIR/fs/Kconfig" "fs/Kconfig" "JFFS3" "Miscellaneous filesystems";
+	patch_fs_Makefile "fs/Makefile" 'CONFIG_JFFS2_FS' 'obj-$(CONFIG_JFFS3_FS)		+= jffs3/'
 fi
 
 echo "Patching done"





More information about the linux-mtd-cvs mailing list