#!/bin/bash

# Examples:
# ./update-latest.sh Bitten 0.6
# ./update-latest.sh BittenSlave 0.6

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

distname=$1
version=$2
echo "Updating links to $DISTNAME version $VERSION"

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

