]> gitweb.fluxo.info Git - puppet-backup.git/commitdiff
Local cache support on sync-media-init
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 31 May 2013 18:44:48 +0000 (15:44 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 31 May 2013 18:44:48 +0000 (15:44 -0300)
files/sync-media-init

index e16dbf04ab04abc9b8d3f565ebabc3ebbc9f89e0..035da0242aee3b8b0f8460b92ac9e4c6261453eb 100644 (file)
@@ -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