aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-10-02 17:01:43 -0300
committerSilvio Rhatto <rhatto@riseup.net>2016-10-02 17:01:43 -0300
commit599d3625ebf95ba47ef298f5960f321cabe24401 (patch)
tree7a6bf48664293318d859d5cf82b2f7165f71f497 /share
parentb22deae56d95fef24ef9cf4421b8b5e99c41a57f (diff)
downloadhydra-599d3625ebf95ba47ef298f5960f321cabe24401.tar.gz
hydra-599d3625ebf95ba47ef298f5960f321cabe24401.tar.bz2
Remote destination support at sync-media-export
Diffstat (limited to 'share')
-rwxr-xr-xshare/hydractl/sync-media-export26
1 files changed, 17 insertions, 9 deletions
diff --git a/share/hydractl/sync-media-export b/share/hydractl/sync-media-export
index 7b47639..8647acc 100755
--- a/share/hydractl/sync-media-export
+++ b/share/hydractl/sync-media-export
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copy git-annex repositories to remote server.
+# Copy git-annex repositories to remote destination.
#
# Parameters
@@ -23,15 +23,23 @@ for file in `ls $MEDIA`; do
cd $MEDIA
- if ssh $DESTINATION if [ -d \"/var/cache/media/$file\" ] \; then echo exists\; fi | grep -q exists; then
- echo "Remote $file already exists, skipping..."
- continue;
- fi
+ # Check for remote or local destinations
+ if [ ! -d "$DESTINATION" ]; then
+ if ssh $DESTINATION if [ -d \"/var/cache/media/$file\" ] \; then echo exists\; fi | grep -q exists; then
+ echo "Remote $file already exists, skipping..."
+ continue;
+ fi
- git clone $file $file.git && \
- rsync -avz $file.git/ $DESTINATION:/var/cache/media/$file/ && \
- rm -rf $file.git
- echo ""
+ git clone $file $file.git && \
+ rsync -avz $file.git/ $DESTINATION:/var/cache/media/$file/ && \
+ rm -rf $file.git
+ echo ""
+ else
+ mkdir -p $DESTINATION/var/cache/media
+ if [ ! -d "$DESTINATION/var/cache/media/$FILE" ]; then
+ ( cd $DESTINATION/var/cache/media && git clone $MEDIA/$file )
+ fi
+ fi
)
fi
done