[ "$1" ] || exit 1

SRC=/tux/src
DST=/tux/pkg

if cd $SRC/$1
then
	echo "Creating $DST/$1.tgz"
	tar czvf $DST/$1.tgz .
	ls -al $DST/$1.tgz
else
	echo "Package not found."
fi


echo -n "Statlab? "
read blah

[ "$blah" == 'y' ] || exit 1

kernel=`echo $1.tgz | cut -d'/' -f1`

if echo $kernel | grep tgz 2> /dev/null
then
	kernel=""
else
	echo "Building package for kernel: $kernel"
fi


echo "Copying to Cisco"
scp -v $DST/$1.tgz root@statlab.cisco.com:/opt/pkg/$kernel
#scp -v $DST/$1.tgz root@samara.cisco.com:/tux/pkg/$kernel

echo -n "Public? "
read blah

[ "$blah" == 'y' ] || exit 1

scp -v $DST/$1.tgz mdfranz@trinux.sourceforge.net:~/trinux/htdocs/pkg/$kernel
scp -v $DST/$1.tgz mdfranz@bermuda.io.com:~/trinux/pkg/$kernel
#scp -v $DST/$1.tgz trinux@trinux.org:~/htdocs/pkg/$kernel
