From 26cd512aa7b8f5f9d7cbeaa4c7fd34641c030301 Mon Sep 17 00:00:00 2001 From: Cache do Fluxo Date: Tue, 8 Nov 2016 18:16:10 -0200 Subject: Adds custom synchronizer --- .sync-media/custom | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 .sync-media/custom 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 " + 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 -- cgit v1.2.3 From 0e9bcce75c6f2d60c2881e7987954fa177d2bfb3 Mon Sep 17 00:00:00 2001 From: Cache do Fluxo Date: Fri, 11 Nov 2016 12:43:26 -0200 Subject: Custom sync: enhance empty folder check --- .sync-media/custom | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sync-media/custom b/.sync-media/custom index 0ae38d2..2ef4b58 100755 --- a/.sync-media/custom +++ b/.sync-media/custom @@ -20,7 +20,7 @@ elif [ ! -d "$DEST" ]; then fi # Check if there are assets -if [ ! -z "$(ls -A $ASSETS)" ]; then +if [ ! -z "$(ls -A $ASSETS)" ] || [ "$(ls -A $ASSETS)" != ".empty" ]; then # Then sync unison $ASSETS $DEST -auto -logfile /dev/null fi -- cgit v1.2.3 From fdc2ed89ec245205da28e4538349c93ddda8ea53 Mon Sep 17 00:00:00 2001 From: Cache do Fluxo Date: Tue, 15 Nov 2016 10:02:49 -0200 Subject: Fix custom syncer --- .sync-media/custom | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sync-media/custom b/.sync-media/custom index 2ef4b58..325ab69 100755 --- a/.sync-media/custom +++ b/.sync-media/custom @@ -20,7 +20,7 @@ elif [ ! -d "$DEST" ]; then fi # Check if there are assets -if [ ! -z "$(ls -A $ASSETS)" ] || [ "$(ls -A $ASSETS)" != ".empty" ]; then +if [ ! -z "$(ls -A $ASSETS)" ] && [ "$(ls -A $ASSETS)" != ".empty" ]; then # Then sync unison $ASSETS $DEST -auto -logfile /dev/null fi -- cgit v1.2.3