#
#
# Does a build in the XServe

. scripts/build_package_prepare_upload_unpack_windows

logpath=log
if test "$outdir" != ""; then
        logpath="$outdir/log"
fi

source_dir=`basename $source_tar .tar.gz`

# 5.2 is Alpha, rest is Ga
vertype=g
if test `echo $version|cut -d. -f1-2` == 5.2; then
	vertype=a
fi


echo "Building"
if test "$autobuild" == 1; then
scripts/runcmd  -m="------" -l=$logpath.$caller.`whoami` $sshcmd $target_host \'cmd /c \"$target_build_dir\\guibuild.bat\" $edition $version $vertype\'
else
scripts/runcmd  -n=$caller -m="------" -l=$logpath.$caller.`whoami` $sshcmd $target_host \'cmd /c \"$target_build_dir\\guibuild.bat\" $edition $version $vertype\'
fi
if [ $? -ne 0 ]; then
	echo "$0 failed"
	exit 1
fi

outgoing=$outdir
if test "$outgoing" = ""; then
        outgoing="outgoing"
fi

echo "Getting msi"
cp /guibuilds/winshare/$source_dir/build/msi/distribution/*msi $outgoing

echo "Getting zip"
cp /guibuilds/winshare/$source_dir/build/zip/distribution/*zip $outgoing

echo "Done"

