#!/bin/bash
#
# THIS IS ONLY FOR CORE TEAM MEMBERS.  IT WON'T WORK IF YOU'RE NOT A CORE
# TEAM MEMBER.  DON'T BOTHER

if [ $# != 1 ]; then
  echo "Run this as $0 <libc-string>"
  echo "e.g. $0 glibc2"
  echo "     $0 libc5"
  exit 1
fi

eval `grep "^MAJOR_VERSION=" configure.in`
eval `grep "^MINOR_VERSION=" configure.in`
eval `grep "^PICO_VERSION=" configure.in`
Release=$MAJOR_VERSION.$MINOR_VERSION.$PICO_VERSION

echo '######################################################################'
echo " Uploading release $Release for $0"
echo '######################################################################'

cd /opt
if [ ! -f lesstif-$Release-linux-$1.tar.gz ]
then
	echo "file not found"
	exit
fi
ftp ftp.hungry.com <<-EOF
bin
hash
cd /usr/ftp/pub/hungry/lesstif/bindist
put lesstif-$Release-linux-$1.tar.gz
bye
EOF

#
# FIXME: ftp always returns 0.  How do I tell if this worked?
#
if [ $? -eq 0 ]
then
mail -s "LessTif $Release Linux $1 binary" lesstif@hungry.com <<-EOF
The binary distribution of LessTif $Release for Linux ($1)
has just been uploaded to

ftp.lesstif.org:/pub/hungry/lesstif/bindist/lesstif-$Release-linux-$1.tar.gz

Jon Christopher
Lesstif Releasemeister
EOF
	echo "ftp okay"
# clean up
        /bin/rm -rf /opt/lesstif*
else
	echo "ftp problem"
fi

echo '######################################################################'
echo " Done uploading release $Release for $0"
echo '######################################################################'

