#!/bin/bash
#
# Make and upload linux RPMs for Lesstif
# jac July 2, 1998
#

if test "$LOGNAME" != "jon"
then
    echo "Take off ehh!!"
    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

# get current source tree and put in /usr/src/redhat/SOURCES
ftp ftp.hungry.com <<-EOF
bin
hash
cd /usr/ftp/pub/hungry/lesstif/srcdist
dir
lcd /usr/src/redhat/SOURCES
get lesstif-$Release.tar.gz 
bye
EOF

# # Make the RPM's
rpm -ba scripts/RedHat/lesstif.spec

# Put the rpms on the ftp server
ftp ftp.hungry.com <<-EOF
bin
hash
prompt
cd /usr/ftp/pub/hungry/lesstif/bindist
lcd /usr/src/redhat/SRPMS
mput lesstif-*
lcd /usr/src/redhat/RPMS/i386
mput lesstif-*
bye
EOF

#
# tell the world about it.
#
if [ $? -eq 0 ]
then
mail -s "LessTif $Release Linux RPMs" lesstif@hungry.com <<-EOF
The RPMs for LessTif $Release for Linux have just been uploaded to

       ftp.lesstif.org:/pub/hungry/lesstif/bindist/

Jon Christopher
Lesstif Releasemeister
EOF
	echo "rpm ftp okay"
else
	echo "rpm ftp problem"
fi

# clean up
/bin/rm -rf /usr/src/redhat/SOURCES/lesstif-$Release.tar.gz
/bin/rm -rf /usr/src/redhat/SRPMS/lesstif-*
/bin/rm -rf /usr/src/redhat/RPMS/i386/lesstif-*
/bin/rm -rf /usr/src/redhat/BUILD/lesstif-*


