aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCache do Fluxo <cache@fluxo.info>2017-03-25 19:15:35 -0300
committerCache do Fluxo <cache@fluxo.info>2017-03-25 19:15:35 -0300
commit000d7162dbb8d8212ec10908bf4de6ae8c2ca1e3 (patch)
tree5718419f705a5574df7ee829a080525433a54a01
parent36f075fc1a8a852218d5e3778ed880acedc35031 (diff)
parentfdc2ed89ec245205da28e4538349c93ddda8ea53 (diff)
downloadcache-000d7162dbb8d8212ec10908bf4de6ae8c2ca1e3.tar.gz
cache-000d7162dbb8d8212ec10908bf4de6ae8c2ca1e3.tar.bz2
Merge branch 'develop' of git.fluxo.info:cache into develop
-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..325ab69
--- /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)" ] && [ "$(ls -A $ASSETS)" != ".empty" ]; then
+ # Then sync
+ unison $ASSETS $DEST -auto -logfile /dev/null
+fi