summaryrefslogtreecommitdiff
path: root/rep-publish
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-10-01 17:01:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-10-01 17:01:02 +0200
commit8bb9d760b54f103fe1c6be67fde307666b81b789 (patch)
tree297da8f42c8aa0d377a2db677d29ee16be198908 /rep-publish
parent8253c613c49dd2c1aaac424ed932dffa52c494a9 (diff)
Add rep-{update,test,publish} scripts
Diffstat (limited to 'rep-publish')
-rwxr-xr-xrep-publish33
1 files changed, 33 insertions, 0 deletions
diff --git a/rep-publish b/rep-publish
new file mode 100755
index 0000000..8db26e0
--- /dev/null
+++ b/rep-publish
@@ -0,0 +1,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 -rlpt -c --exclude '.*' --copy-unsafe-links --prune-empty-dirs \
+--delete-after $* $dir/ $host