Whamcloud - gitweb
LU-3208 tests: Fix typo in replay-single/70b
[fs/lustre-release.git] / lustre / kernel_patches / scripts / pcpatch
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 "pcpatch: recreate the pc file from patches/{patchname}.patch"
12         exit 1
13 }
14
15 doit()
16 {
17         echo $* 1>&2
18         $* || {
19                 echo oops
20                 exit 1 
21         }
22 }
23
24 if [ $# != 1 -o "$1" = "help" ]
25 then
26         usage
27 fi
28 PATCH=$1
29 PATCH_NAME=$(stripit $PATCH)
30 PC=$P/pc/$PATCH_NAME.pc
31
32 if [ ! -e $P/patches/$PATCH_NAME.patch ] 
33 then
34         echo "$P/patches/$PATCH_NAME.patch does not exist"
35         exit 1
36 fi
37
38 if is_applied "$PATCH"
39 then
40         echo $PATCH is applied!
41         exit 1
42 fi
43
44 touched-by-patch $P/patches/$PATCH_NAME.patch > $PC
45 echo Recreated $PC