]> gitweb.fluxo.info Git - puppet-backup.git/commitdiff
Try to copy files to a remote at sync-media
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 18 Apr 2014 01:45:27 +0000 (22:45 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 18 Apr 2014 01:45:27 +0000 (22:45 -0300)
files/sync-media

index 4e98e12620c116b5e8327d8bc674961911903b5f..ea1c43092e3d953c0f33f40502968661ac70c750 100644 (file)
@@ -166,4 +166,22 @@ if [ ! -z "$DRIVE" ] && [ -d "$VOLUME/$MEDIA" ]; then
       rsync -av --delete $CACHE/$folder/ $VOLUME/$MEDIA/$folder/
     fi
   done
+else
+  # Try to copy to a remote
+  for folder in `ls $CACHE`; do
+    if [ -d "$CACHE/$folder/.git/annex" ]; then
+      (
+      if git remote | grep -q "^$DISK$"; then
+        cd $CACHE/$folder
+        git annex copy . --to $DISK
+      else
+        echo "No such remote $DISK"
+      fi
+      )
+    else
+      REMOTE="$DISK.$DOMAIN"
+      echo "Syncing $VOLUME/$MEDIA/$folder..."
+      rsync -av --delete $CACHE/$folder/ $REMOTE:$CACHE/$folder/
+    fi
+  done
 fi