#!/bin/bash

# Script to pull an updated version of the resource files from
# the Subversion repository onto publically available space on AFS
# (accessible by student from AFS or via http).
#
# Optional first argument to script is used for specifying different HOST
# for the transfer

HOST=addiator.rose-hulman.edu
#HOST=sliderule.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
# Public portion of the repository resides.
TARGDIR=/Class/csse/csse221/200910

# The local subdirectory which corresponds to the Public portion of the
# repository.
PUBLIC=200910

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

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

