aboutsummaryrefslogtreecommitdiff
path: root/.sync-media/custom
diff options
context:
space:
mode:
authorCache do Fluxo <cache@fluxo.info>2016-11-08 18:16:10 -0200
committerCache do Fluxo <cache@fluxo.info>2016-11-08 18:16:10 -0200
commit26cd512aa7b8f5f9d7cbeaa4c7fd34641c030301 (patch)
tree14830a557b0e9d4aad4ac491f3729cdaaad0538b /.sync-media/custom
parent7f42f111c4f243c6470ec13be3d8508c930c7e46 (diff)
downloadcache-26cd512aa7b8f5f9d7cbeaa4c7fd34641c030301.tar.gz
cache-26cd512aa7b8f5f9d7cbeaa4c7fd34641c030301.tar.bz2
Adds custom synchronizer
Diffstat (limited to '.sync-media/custom')
-rwxr-xr-x.sync-media/custom26
1 files changed, 26 insertions, 0 deletions
diff --git a/.sync-media/custom b/.sync-media/custom
new file mode 100755
index 0000000..0ae38d2
--- /dev/null
+++ b/.sync-media/custom
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# Custom syncronizer for hydractl sync-media.
+#
+
+# Parameters
+BASENAME="`basename $0`"
+DIRNAME="`dirname $0`"
+BASE="`cd $DIRNAME/.. && pwd`"
+DEST="$1/data"
+ASSETS="$BASE/data"
+
+# Syntax
+if [ "$DEST" == "/data" ]; then
+ echo "usage: $BASENAME <dest>"
+ exit 1
+elif [ ! -d "$DEST" ]; then
+ echo "folder $DEST does not exist."
+ exit 1
+fi
+
+# Check if there are assets
+if [ ! -z "$(ls -A $ASSETS)" ]; then
+ # Then sync
+ unison $ASSETS $DEST -auto -logfile /dev/null
+fi