4 # Fork the next patch in the series
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"
15 echo "Usage: forkpatch <newname>"
30 echo 'File "series" not found'
34 if [ -f $P/$BASE.patch ] ; then
35 echo "Patch $NEW already exists as a file"
39 if grep $BASE $SERIES >& /dev/null ; then
40 echo "Patch $NEW already exists in series"
44 TMPSERIES=$(mktemp /tmp/series-XXXXXXXX)
48 todo=$(head -1 $SERIES)
50 last_in_series=$(stripit $(tail -1 $SERIES))
51 if [ $last_in_series == $top ]
53 echo "Series fully applied. Ends at $top"
56 todo=$(grep -C1 "^$top\.patch" $SERIES | tail -1)
59 todo=$(head -1 $SERIES)
63 basetodo=`stripit $todo`
65 sed "s/$todo/$BASE.patch/" < $SERIES > $TMPSERIES
66 cat $TMPSERIES > $SERIES
68 cp -f $P/patches/$todo $P/patches/$BASE.patch
69 cp -f $P/pc/$basetodo.pc $P/pc/$BASE.pc
70 if [ -f $P/txt/$basetodo.txt ]; then
71 cp -f $P/txt/$basetodo.txt $P/txt/$BASE.txt
73 echo "Warning no documentation for $BASE"
76 echo "Cloned $todo to $BASE"