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: trypatch <newname>"
30 echo 'File "series" not found'
34 if grep $BASE $SERIES >& /dev/null ; then
35 echo "Patch $NEW already exists in series"
39 if [ ! -f $P/patches/$BASE.patch ] ; then
40 echo "Patch $NEW doesn't exist as a file"
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 if patch -p1 -i $P/patches/$BASE.patch ; then
64 patch -R -p1 -i $P/patches/$BASE.patch
66 $basetodo=$(basename $todo)
67 sed "s/$todo/$BASE/" < $SERIES > $TMPSERIES
68 mv -f $TMPSERIES $SERIES
69 echo "Replaced $todo with $BASE"
71 echo "Failed to replace $todo with $BASE"