#!/bin/bash

# Script to pull an updated version of the grading scripts for this course from
# a Subversion repository onto publicly available space on AFS
#
# Optional first argument to script is used for specifying different HOST
# for the transfer

#HOST=clifton@clive.cs.rose-hulman.edu
#HOST=addiator.rose-hulman.edu
HOST=sliderule.csse.rose-hulman.edu
#HOST=abacus.rose-hulman.edu
if [ "${1}" != "" ] ; then
	HOST="${1}"
fi

# The directory on the remote host where the checked-out copy of the
# scripts directory resides.
TARGDIR=/Class/csse/csse220/scripts

# The local scripts subdirectory
PUBLIC=`dirname ${0}`

if [ -n "`svn st \"${PUBLIC}\"`" ] ; then
	echo "Uncommitted changes in ${PUBLIC}"
	echo "Commit changes before publishing"
	exit 1
fi

ssh ${HOST} "svn up \"${TARGDIR}\""