#!/bin/bash

if [ -z "$1" ]
then
  echo "Usage: `basename $0` version"
  exit $E_NOARGS
fi

version=$1
echo "Updating links to version $VERSION"

for format in "-py2.4.egg" "-py2.5.egg" "-py2.6.egg" "-py2.7.egg" \
              "-py2.5-linux-x86_64.egg" "-py2.6-linux-x86_64.egg" \
              "-py2.7-linux-x86_64.egg" "-py3.2-linux-x86_64.egg" \
              "-py3.3-linux-x86_64.egg" \
              ".tar.gz" ".zip" ".win32.exe" ".win32-py2.7.exe"
do
  rm -f Genshi-latest$format*
  if [[ -f "Genshi-$version$format" ]]
  then
    md5sum Genshi-$version$format > Genshi-$version$format.md5
    ln -s Genshi-$version$format Genshi-latest$format
    ln -s Genshi-$version$format.md5 Genshi-latest$format.md5
  fi
done
