aboutsummaryrefslogtreecommitdiff
path: root/files/sync-media
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-04-18 02:33:01 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-04-18 02:33:01 -0300
commitf77abee5d3586991eb39f57258c147d608994a3d (patch)
tree7199eccd880dc67cd9e44dbd6c78d68fd038559f /files/sync-media
parent04a6d260840dae2399e1df18a231929a63c1b807 (diff)
downloadpuppet-backup-f77abee5d3586991eb39f57258c147d608994a3d.tar.gz
puppet-backup-f77abee5d3586991eb39f57258c147d608994a3d.tar.bz2
Renaming variable at sync-media
Diffstat (limited to 'files/sync-media')
-rw-r--r--files/sync-media17
1 files changed, 8 insertions, 9 deletions
diff --git a/files/sync-media b/files/sync-media
index a9bd422..dfeabeb 100644
--- a/files/sync-media
+++ b/files/sync-media
@@ -3,8 +3,8 @@
# sync-media assets using git-annex
#
-DISK="$1"
-VOLUME="/media/$DISK"
+REMOTE="$1"
+VOLUME="/media/$REMOTE"
CACHE="/var/cache/media"
DOMAIN="`facter domain`"
HOST="`facter hostname`"
@@ -105,7 +105,7 @@ if [ -d "$CACHE" ]; then
fi
done
- if [ ! -z "$DISK" ]; then
+ if [ ! -z "$REMOTE" ]; then
# Check storage media
MOUNT="`mount | grep $VOLUME`"
if [ ! -z "$MOUNT" ]; then
@@ -178,7 +178,7 @@ if [ ! -z "$DRIVE" ] && [ -d "$VOLUME/$MEDIA" ]; then
rsync -av --delete $CACHE/$folder/ $VOLUME/$MEDIA/$folder/
fi
done
-elif [ ! -z "$DISK" ]; then
+elif [ ! -z "$REMOTE" ]; then
# Try to copy to a remote
for folder in `ls $CACHE`; do
if [ -d "$CACHE/$folder/.git/annex" ]; then
@@ -186,18 +186,17 @@ elif [ ! -z "$DISK" ]; then
continue
fi
- if git -C $CACHE/$folder remote | grep -q "^$DISK$"; then
+ if git -C $CACHE/$folder remote | grep -q "^$REMOTE$"; then
(
cd $CACHE/$folder
- git annex copy . --to $DISK
+ git annex copy . --to $REMOTE
)
else
- echo "No such remote $DISK"
+ echo "No such remote $REMOTE"
fi
else
- REMOTE="$DISK.$DOMAIN"
echo "Syncing $VOLUME/$MEDIA/$folder..."
- rsync -av --delete $CACHE/$folder/ $REMOTE:$CACHE/$folder/
+ rsync -av --delete $CACHE/$folder/ $REMOTE.$DOMAIN:$CACHE/$folder/
fi
done
fi