Whamcloud - gitweb
b=17671
[fs/lustre-release.git] / lustre / kernel_patches / scripts / combine-series
1 #!/bin/sh
2
3 #
4 # Make superpatch from current series using combinediff.
5 #
6
7 . patchfns >/dev/null || . /usr/lib/patch-scripts/patchfns >/dev/null || { \
8         echo "Impossible to find my library 'patchfns'."
9         echo "Check your install, or go to the right directory"
10         exit 1
11 }
12
13 usage()
14 {
15         echo "Usage: combine-series output-file"
16         exit 1
17 }
18
19 if [ $# -ne 1 ] 
20 then
21         usage
22 fi
23
24 need_file_there series
25 CURRENT=$(mktemp /tmp/cmbd-XXXXXXXX)
26 for FILE in $(cat series)
27 do
28         NEXT=$(mktemp /tmp/cmbd-XXXXXXXX)
29         if [ -f $P/patches/$FILE ] 
30         then
31                 combinediff $CURRENT $P/patches/$FILE > $NEXT
32         elif [ -f $P/patches/$FILE.patch ]
33         then
34                 combinediff $CURRENT $P/patches/$FILE.patch > $NEXT
35         elif [ -f $FILE ]
36         then
37                 combinediff $CURRENT $FILE > $NEXT
38         fi
39         rm $CURRENT
40         CURRENT=$NEXT
41 done
42
43 mv $NEXT "$1"