]> gitweb.fluxo.info Git - puppet-backup.git/commitdiff
Allow per-repo git-annex get configs at sync-media
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 25 Mar 2016 15:34:22 +0000 (12:34 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 25 Mar 2016 15:34:22 +0000 (12:34 -0300)
files/sync-media

index 1c312c42a7b36e5804d0032bd04bdec808dbb096..d6102451173d1283173ae998500e628087904535 100755 (executable)
@@ -71,6 +71,22 @@ function sync_media_dropunused {
   fi
 }
 
+# Get copies of annexed files
+function sync_media_get {
+  local repo="$1"
+  local numcopies
+
+  if [ "`git -C $repo config sync-media.get`" != "false" ]; then
+    if git -C $repo config sync-media.numcopies &> /dev/null; then
+      numcopies="`git -C $repo config sync-media.numcopies`"
+    else
+      numcopies="3"
+    fi
+
+    git annex get . --numcopies=$numcopies
+  fi
+}
+
 # Control whether the repository should have a copy of everything
 function sync_media_getall {
   local repo="$1"
@@ -216,7 +232,8 @@ if [ ! -z "$DRIVE" ] && [ -d "$VOLUME/$MEDIA" ]; then
       sync_media_identity
       sync_media_add
       git annex sync
-      git annex get . --numcopies=3
+      sync_media_get    $VOLUME/$MEDIA/$folder
+      sync_media_getall $VOLUME/$MEDIA/$folder
       sync_media_fsck
       sync_media_dropunused
       #git annex drop --auto --numcopies=2