#!/bin/sh
set -e # stop if we encounter an error

make clean # clean cruft

svn update # get changes

make -j3 # abuse the cores

# don't copy over stuff with permissions that make it useless
#chmod a+r * -R
chmod -R a+r *
rsync --exclude .svn --exclude .deps --exclude svn --exclude dist --exclude releases --exclude torbutton-current.xpi --exclude project -Prvz --delete . vescum:/srv/www-master.torproject.org/htdocs

echo "Forcing mirror update"
ssh vescum '/home/mirroradm/bin/trigger-mirrors'
ssh vescum chmod g+w -R /srv/www-master.torproject.org/htdocs