aboutsummaryrefslogtreecommitdiff
path: root/files/sync-media-init
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-05-31 15:44:48 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-05-31 15:44:48 -0300
commit9f6fe3135cc920cee14ee2284d4d2bdab35924a6 (patch)
tree0c4ee34259ac9f092e1cb261f6a331badcc80c1e /files/sync-media-init
parent3e2b07f09b0cde2fbc2a7a7c2cfcf88452945583 (diff)
downloadpuppet-backup-9f6fe3135cc920cee14ee2284d4d2bdab35924a6.tar.gz
puppet-backup-9f6fe3135cc920cee14ee2284d4d2bdab35924a6.tar.bz2
Local cache support on sync-media-init
Diffstat (limited to 'files/sync-media-init')
-rw-r--r--files/sync-media-init10
1 files 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