#!/bin/bash

. ./config-settings.bash

commit_msg=$1

GSDLOS=linux
# Test to make sure we are operating in a directory structure which was checked out as
#  /gs2-extensions/perl-with-cpan/trunk
# meaning 'src' is a subdir and therefore ../. is the location where the tarballs go
# and are commited

svn_prefix=$(  cd .. && svn info | egrep "^Relative URL:" | awk -F: '{ print $2 }' )

if [ "x$svn_prefix" != "x ^/main/trunk/gs2-extensions/subversion" ] ; then
    echo "Parent directory is not under svn control as:" >&2
    echo "  /main/trunk/gs2-extensions/subversion" >&2
    echo "Unsafe to copy Subversion tarballs to parent directory and commit" >&2
    echo "Stopping!" >&2
	exit 1
fi

# Work out the bitness for the environment we compiled subversion for
true_bitness=`getconf LONG_BIT`

#/bin/mv src/subversion-$GSDLOS.tar.gz  ../.
#/bin/mv src/subversion-$src.tar.gz  ../.

if [ "x$commit_msg" = "x" ] ; then
    commit_msg="Latest version of subversion source tarball and of its binary for Greenstone $GSDLOS ${true_bitness} release-builder."
fi
echo "*** commit_msg: $commit_msg"
echo "Next run: svn commit -m '$commit_msg' subversion-$GSDLOS${true_bitness}.tar.gz subversion-src.tar.gz"
#svn commit -m "$commit_msg" subversion-$GSDLOS.tar.gz subversion-src.tar.gz
