--- patch-kernel.orig 2003-05-02 17:47:53.000000000 +0200 +++ patch-kernel 2003-05-02 17:47:53.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Script to apply kernel patches. -# usage: patch-kernel [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ] +# usage: patch-kernel [ sourcedir [ patchdir [ stopversion ] [ -acxx || -bkxx ] ] ] # The source directory defaults to /usr/src/linux, and the patch # directory defaults to the current directory. # e.g. @@ -41,6 +41,11 @@ # Added -ac option, use -ac or -ac9 (say) to stop at a particular version # Dave Gilbert , 29th September 2001. +# Added ability to deal with -bk patches from linus +# +# Added -bk option, use -bk or -bk9 (say) to stop at a particular version +# Wiktor Wodecki , 02th May 2003. + # Set directories from arguments, or use defaults. sourcedir=${1-/usr/src/linux} patchdir=${2-.} @@ -48,19 +53,19 @@ if [ "$1" = -h -o "$1" = --help -o ! -r "$sourcedir/Makefile" ]; then cat << USAGE -usage: patch-kernel [-h] [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ] +usage: patch-kernel [-h] [ sourcedir [ patchdir [ stopversion ] [ -acxx | -bkxx ] ] ] The source directory defaults to /usr/src/linux, and the patch directory defaults to the current directory. USAGE exit 1 fi -# See if we have any -ac options +# See if we have any -ac/-bk options for PARM in $* do case $PARM in - -ac*) - gotac=$PARM; + -ac*|-bk*) + gotbleeding=$PARM; esac; done @@ -163,39 +168,39 @@ applyPatch $patch || break done -if [ x$gotac != x ]; then - # Out great user wants the -ac patches +if [ x$gotbleeding != x ]; then + # Out great user wants the -ac/bk patches # They could have done -ac (get latest) or -acxx where xx=version they want - if [ $gotac == "-ac" ] + if [ $gotbleeding == "-ac" ] || [ $gotbleeding == "-bk" ] then # They want the latest version HIGHESTPATCH=0 - for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.* + for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-${gotbleeding}*\.* do - ACVALUE=`echo $PATCHNAMES | sed -e 's/^.*patch-[0-9.]*-ac\([0-9]*\).*/\1/'` + BLEEDVALUE=`echo $PATCHNAMES | sed -e 's/^.*patch-[0-9.]*-${gotbleeding}\([0-9]*\).*/\1/'` # Check it is actually a recognised patch type - findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${ACVALUE} || break + findFile $patchdir/patch-${CURRENTFULLVERSION}-${gotbleeding}${BLEEDVALUE} || break - if [ $ACVALUE -gt $HIGHESTPATCH ] + if [ $BLEEDVALUE -gt $HIGHESTPATCH ] then - HIGHESTPATCH=$ACVALUE + HIGHESTPATCH=$BLEEDVALUE fi done if [ $HIGHESTPATCH -ne 0 ] then - findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${HIGHESTPATCH} || break - applyPatch patch-${CURRENTFULLVERSION}-ac${HIGHESTPATCH} + findFile $patchdir/patch-${CURRENTFULLVERSION}-${gotbleeding}${HIGHESTPATCH} || break + applyPatch patch-${CURRENTFULLVERSION}-${gotbleeding}${HIGHESTPATCH} else - echo "No ac patches found" + echo "No `echo $gotbleeding|awk -F\- '{print $2}'` patches found" fi else # They want an exact version - findFile $patchdir/patch-${CURRENTFULLVERSION}${gotac} || { - echo "Sorry, I couldn't find the $gotac patch for $CURRENTFULLVERSION. Hohum." + findFile $patchdir/patch-${CURRENTFULLVERSION}${gotbleeding} || { + echo "Sorry, I couldn't find the `echo $gotbleeding|awk -F\- '{print $2}'` patch for $CURRENTFULLVERSION. Hohum." exit 1 } - applyPatch patch-${CURRENTFULLVERSION}${gotac} + applyPatch patch-${CURRENTFULLVERSION}${gotbleeding} fi fi