#!/usr/bin/env bash

set -ex

GOPATH=/home/vagrant/go
export GOROOT=/usr/local/go
export PATH=$GOROOT/bin:$PATH

echo "Installing bosh-agent..."
mkdir -p $(dirname $GOROOT)
chmod -R a+w $GOROOT

if [ ! -d $TMPDIR ]; then
  mkdir -p $TMPDIR
fi

agent_dir=$GOPATH/src/github.com/cloudfoundry/bosh-agent

pushd $agent_dir
	sudo sv stop agent

	# build agent
	bin/build

	# install new agent
	sudo cp out/bosh-agent /var/vcap/bosh/bin/bosh-agent
popd
#!/usr/bin/env bash

set -ex

GOPATH=/home/vagrant/go
export GOROOT=/usr/local/go
export PATH=$GOROOT/bin:$PATH

echo "Installing bosh-agent..."
mkdir -p $(dirname $GOROOT)
chmod -R a+w $GOROOT

if [ ! -d $TMPDIR ]; then
  mkdir -p $TMPDIR
fi

agent_dir=$GOPATH/src/github.com/cloudfoundry/bosh-agent

pushd $agent_dir
	sudo sv stop agent

	# bosh-provisioner sends an apply spec that is no longer compatible with the agent
	sudo rm -f /var/vcap/bosh/spec.json

	# build agent
	bin/build

	# install new agent
	sudo cp out/bosh-agent /var/vcap/bosh/bin/bosh-agent
popd
Remove incompatible spec.json before tests
Remove incompatible spec.json before tests

[#134619633](https://www.pivotaltracker.com/story/show/134619633)

Signed-off-by: Jamil Shamy <1a6c312d8b7ebde5d54d0b4f1a4353b7c149e3bf@pivotal.io>
