blob: 6e555a4f09208fa7e45fddde5d5a7347c2d15b6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#! /usr/bin/env bash
# Publish the repository.
#
# Usage: publish <dir> <host>:<dir> [<rsync-options>]
#
# Some commonly useful rsync options:
#
# --dry-run
# --progress
#
usage="$0 <dir> <host>:<dir> [<rsync-options>]"
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 -rltO -c --chmod=ugo=rwX --exclude '.*' --copy-unsafe-links \
--prune-empty-dirs --delete-after $* $dir/ $host
|