Whamcloud - gitweb
- bring in akpm's patch management scripts and a first cut at
[fs/lustre-release.git] / lustre / kernel_patches / scripts / combine-applied
diff --git a/lustre/kernel_patches/scripts/combine-applied b/lustre/kernel_patches/scripts/combine-applied
new file mode 100755 (executable)
index 0000000..8768b29
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+#
+# Make superpatch from currently applied patches using combinediff.
+#
+
+. patchfns >/dev/null || . /usr/lib/patch-scripts/patchfns >/dev/null || { \
+       echo "Impossible to find my library 'patchfns'."
+       echo "Check your install, or go to the right directory"
+       exit 1
+}
+
+usage()
+{
+       echo "Usage: combine-applied output-file"
+       exit 1
+}
+
+if [ $# -ne 1 ] 
+then
+       usage
+fi
+
+need_file_there applied-patches
+CURRENT=$(mktemp /tmp/cmbd-XXXXXXXX)
+for FILE in `cat applied-patches`
+do
+       NEXT=$(mktemp /tmp/cmbd-XXXXXXXX)
+       if [ -f $P/patches/$FILE ] 
+       then
+               combinediff $CURRENT $P/patches/$FILE > $NEXT
+       elif [ -f $P/patches/$FILE.patch ]
+       then
+               combinediff $CURRENT $P/patches/$FILE.patch > $NEXT
+       elif [ -f $FILE ]
+       then
+               combinediff $CURRENT $FILE > $NEXT
+       fi
+       rm $CURRENT
+       CURRENT=$NEXT
+done
+
+mv $NEXT "$1"