From 9f6fe3135cc920cee14ee2284d4d2bdab35924a6 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 31 May 2013 15:44:48 -0300 Subject: Local cache support on sync-media-init --- files/sync-media-init | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/files/sync-media-init b/files/sync-media-init index e16dbf0..035da02 100644 --- a/files/sync-media-init +++ b/files/sync-media-init @@ -1,13 +1,12 @@ #!/bin/bash # -# Add git-annex remotes to repository in removable media. +# Add git-annex remotes to repository in removable media or local cache. # # Parameters BASENAME="`basename $0`" VOLUME="$1" DOMAIN="`facter DOMAIN`" -MEDIA="/media/$VOLUME/media.$DOMAIN" #REMOTE_BOXES="" #REMOTE_VOLUMES="" @@ -17,6 +16,13 @@ if [ -z "$VOLUME" ]; then exit 1 fi +# Determine media folder +if [ "$VOLUME" == "`facter hostname`" ]; then + MEDIA="/var/cache/media" +else + MEDIA="/media/$VOLUME/media.$DOMAIN" +fi + # Process each repository for file in `ls $MEDIA`; do if [ -d "$MEDIA/$file/.git/annex" ]; then -- cgit v1.2.3