aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--files/sync-media17
1 files changed, 8 insertions, 9 deletions
diff --git a/files/sync-media b/files/sync-media
index a9bd422..dfeabeb 100644
--- a/files/sync-media
+++ b/files/sync-media
@@ -3,8 +3,8 @@
# sync-media assets using git-annex
#
-DISK="$1"
-VOLUME="/media/$DISK"
+REMOTE="$1"
+VOLUME="/media/$REMOTE"
CACHE="/var/cache/media"
DOMAIN="`facter domain`"
HOST="`facter hostname`"
@@ -105,7 +105,7 @@ if [ -d "$CACHE" ]; then
fi
done
- if [ ! -z "$DISK" ]; then
+ if [ ! -z "$REMOTE" ]; then
# Check storage media
MOUNT="`mount | grep $VOLUME`"
if [ ! -z "$MOUNT" ]; then
@@ -178,7 +178,7 @@ if [ ! -z "$DRIVE" ] && [ -d "$VOLUME/$MEDIA" ]; then
rsync -av --delete $CACHE/$folder/ $VOLUME/$MEDIA/$folder/
fi
done
-elif [ ! -z "$DISK" ]; then
+elif [ ! -z "$REMOTE" ]; then
# Try to copy to a remote
for folder in `ls $CACHE`; do
if [ -d "$CACHE/$folder/.git/annex" ]; then
@@ -186,18 +186,17 @@ elif [ ! -z "$DISK" ]; then
continue
fi
- if git -C $CACHE/$folder remote | grep -q "^$DISK$"; then
+ if git -C $CACHE/$folder remote | grep -q "^$REMOTE$"; then
(
cd $CACHE/$folder
- git annex copy . --to $DISK
+ git annex copy . --to $REMOTE
)
else
- echo "No such remote $DISK"
+ echo "No such remote $REMOTE"
fi
else
- REMOTE="$DISK.$DOMAIN"
echo "Syncing $VOLUME/$MEDIA/$folder..."
- rsync -av --delete $CACHE/$folder/ $REMOTE:$CACHE/$folder/
+ rsync -av --delete $CACHE/$folder/ $REMOTE.$DOMAIN:$CACHE/$folder/
fi
done
fi