#!/bin/sh
# Use rsync to transfer files to a server via ssh, ensuring that the files are transferred with the correct permissions,
# user group. The command will also remove old files from the remote directory.
# To transfer files to the default location, you will need to be a member of the `rr` DoC usergroup.
#
# Example usage:
# DOC_DEPLOY_USER=me ./.deploy.sh

set -x
USER=${DOC_DEPLOY_USER:+${DOC_DEPLOY_USER}@}
SERVER=${DOC_DEPLOY_SERVER:-shell1.doc.ic.ac.uk}
PTH=${DOC_DEPLOY_PATH:-/vol/rr/www}
exec rsync -e ssh --chmod=Dg+s,ug+rwX,o+rX --chown=:rr -igrp --delete _site/ "${USER}${SERVER}:${PTH}"

