#!/bin/sh

update()
{
	echo "git pull"
	git pull || return $?
	echo

	echo "make aggregate"
	make aggregate || return $?
	echo

	echo "make test"
	make test || return $?
	echo

	echo "make"
	make || return $?
	echo
}

cd /opt/swamid-metadata || exit 1
output=$(update 2>&1)
ret=$?
if [ "$ret" != "0" ] ; then
	echo "$output"
	exit $ret
fi