#! /usr/bin/env bash # Publish the repository. # # Usage: publish : [] # # Some commonly useful rsync options: # # --dry-run # --progress # usage="$0 : []" trap 'exit 1' ERR set -o errtrace # Trap in functions. function info () { echo "$*" 1>&2; } function error () { info "$*"; exit 1; } dir=${1%/} if [ -z "$dir" ]; then error $usage fi shift host=$1 if [ -z "$host" ]; then error $usage fi shift rsync -v -rlpt -c --exclude '.*' --copy-unsafe-links --prune-empty-dirs \ --delete-after $* $dir/ $host