if [[ "$1" == "" ]] ; then
  exit
fi
SVN_VERSION="$1"
RELEASE="$2"
MDK_RELEASE="$3"mdk
if [[ "$4" != "" ]] ; then
  FIND="dev build\\\""
  REPLACE="r$RELEASE\\\""
  FULL=
  LINES=7
else
  MACHINE=`sh machine-name`
  FIND="build\\\""
  REPLACE="kernel-$MACHINE-$RELEASE.$MDK_RELEASE build\\\""
  LINES=11
fi
RAW=`grep -n '"dev build"' "$SVN_VERSION" | grep SVN_VER_TAG `
LINE=`echo $RAW | cut -f1 -d:`
head -$(( $LINE + 3 )) $SVN_VERSION | tail -7 > raw.patch
head -4 raw.patch | tail -1 > line.patch
echo diff -rbuN subversion-0.29.0/subversion/include/svn_version.h subversion-0.29.0-patch/subversion/include/svn_version.h 
echo --- subversion-0.29.0/subversion/include/svn_version.h	2003-09-17 19:36:40.000000000 -0400 
echo +++ subversion-0.29.0-patch/subversion/include/svn_version.h	2003-09-17 21:11:58.000000000 -0400 
echo "@@ -$LINE,7 +$LINE,$LINES @@" 
head -3 raw.patch | awk '{print " "$0;}'
echo -n -
cat line.patch
echo -n +
if [[ "$4" == "" ]] ; then
  sed "s/$FIND/$REPLACE/g" line.patch | sed 's/$/ \\/g'
  echo +\"\\nMandrake RPM\\n\" \\
  sh full-machine-name
else
  sed "s/$FIND/$REPLACE/g" line.patch
fi
tail -3 raw.patch | awk '{print " "$0;}'
rm -f raw.patch
rm -f line.patch
