aboutsummaryrefslogtreecommitdiff
path: root/.sync-media/custom
blob: 0ae38d2141607189f3e9c287be05e9efc85a289c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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