#!/bin/sh

if [ "$1" = "" ] ; then
    echo 'Usage: .makedist bin-directory'
    echo 'You should really run this script from "make dist".'
    exit 1
fi    

echo 'Making xcolmix distribution..'

VER=`grep VER version.h |
    sed 's/#define VER "//' |
    sed 's/"//'`
echo 'Version:' $VER

echo 'Copying binary..'
cp $1/xcolmix ../bin-linux/xcolmix

echo 'Making archive..'
cd ../..
tar cvzf xcolmix-$VER.tar.gz xcolmix

echo 'Uploading to ftp site..'
ftp -n << ENDFTP
    open ftp
    user ftp karel@
    cd /pub/incoming/general
    put xcolmix-$VER.tar.gz
    put xcolmix/xcolmix.README xcolmix.README
    put xcolmix/xcolmix.lsm xcolmix.lsm
    quit
ENDFTP

echo 'Remember to move to /pub/unix!'
