#!/bin/sh

version="$1"
target="$2"

if [ -z "$version" ]; then
	echo "no version given!!"
	echo 'usage: mkbindist <version> <target-platform>'
	exit 1
fi

if [ -z "$target" ]; then
	echo "no target given!!"
	echo 'usage: mkbindist <version> <target-platform>'
	exit 1
fi

make clean
make

dir="/tmp/shlight-`whoami`-$$"
mkdir $dir
binary="$dir/Sharity-Light.${version}-${target}"
mkdir $binary

cp shlight $binary
if [ -x unshlight ]; then
	cp unshlight $binary
fi
cp unshlight.sh $binary
cp README $binary
cp Copying $binary
cp Changelog $binary
cp smbmount.8 $binary

cd $dir
tar cf ${binary}.tar $binary
gzip ${binary}.tar

echo
echo "The unpacked binary package is in"
echo "$binary."
echo
echo "The packed binary package is in"
echo "${binary}.tar.gz."
echo "This is the file intended for distribution."
