aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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