Whamcloud - gitweb
Revert "b=19325 adjust waiting extent locks during 1st enqueue"
[fs/lustre-release.git] / lustre / kernel_patches / scripts / poppatch
1 #!/bin/sh
2
3 . patchfns >/dev/null || . /usr/lib/patch-scripts/patchfns >/dev/null || { \
4         echo "Impossible to find my library 'patchfns'."
5         echo "Check your install, or go to the right directory"
6         exit 1
7 }
8
9 usage()
10 {
11         echo "Usage: poppatch [npatches]"
12         exit 1
13 }
14
15 doit()
16 {
17         echo $* 1>&2
18         $* || {
19                 echo oops
20                 exit 1 
21         }
22 }
23
24 if [ $# -gt 1 ]
25 then
26         usage
27 fi
28
29 NR=1
30 STOP_AT=""
31 if [ $# -eq 1 ]
32 then
33         if is_numeric $1
34         then
35                 NR=$1
36         else
37                 NR=1000
38                 STOP_AT=$(stripit $1)
39         fi
40 fi
41
42 pop_one()
43 {
44         TOP_PATCH=$(top_patch)
45         if [ x$TOP_PATCH == x ]
46         then
47                 echo "no patches applied"
48                 exit 0
49         else
50                 popped_patch="$(top_patch)"
51                 if ! rpatch $(top_patch)
52                 then
53                         echo still at $(top_patch)
54                         exit 1
55                 fi
56                 echo
57         fi
58 }
59
60 for i in $(seq 1 $NR)
61 do
62         pop_one
63         if [ x$STOP_AT != "x" ]
64         then
65                 if [ $STOP_AT == $(toppatch) ]
66                 then
67                         sum-series applied-patch
68                         exit 0
69                 fi
70         fi
71 done
72 sum-series applied-patch