diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2016-03-25 12:34:22 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2016-03-25 12:34:22 -0300 |
commit | d5c7bb1ed0eb5c59571a702dc3a43056d09ccc60 (patch) | |
tree | 99aaa8a2b29ce05ca99a4060b0bc8a14401aa372 | |
parent | f095e7c0d8e2f30e6981d73f0df0d72dc9f80d1a (diff) | |
download | puppet-backup-d5c7bb1ed0eb5c59571a702dc3a43056d09ccc60.tar.gz puppet-backup-d5c7bb1ed0eb5c59571a702dc3a43056d09ccc60.tar.bz2 |
Allow per-repo git-annex get configs at sync-media
-rwxr-xr-x | files/sync-media | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/files/sync-media b/files/sync-media index 1c312c4..d610245 100755 --- a/files/sync-media +++ b/files/sync-media @@ -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 |