aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-05-31 15:54:43 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-05-31 15:54:43 -0300
commitba51f5aee1ae27e4bd70619b20b6260471ed9c24 (patch)
treeafabd080b0f8ba680fee0632a4e6e27a318bc542
parent9f6fe3135cc920cee14ee2284d4d2bdab35924a6 (diff)
downloadpuppet-backup-ba51f5aee1ae27e4bd70619b20b6260471ed9c24.tar.gz
puppet-backup-ba51f5aee1ae27e4bd70619b20b6260471ed9c24.tar.bz2
Initializing annex on 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 035da02..295da05 100644
--- a/files/sync-media-init
+++ b/files/sync-media-init
@@ -7,6 +7,7 @@
BASENAME="`basename $0`"
VOLUME="$1"
DOMAIN="`facter DOMAIN`"
+HOST="`facter hostname`"
#REMOTE_BOXES=""
#REMOTE_VOLUMES=""
@@ -17,7 +18,7 @@ if [ -z "$VOLUME" ]; then
fi
# Determine media folder
-if [ "$VOLUME" == "`facter hostname`" ]; then
+if [ "$VOLUME" == "$HOST" ]; then
MEDIA="/var/cache/media"
else
MEDIA="/media/$VOLUME/media.$DOMAIN"
@@ -25,10 +26,15 @@ fi
# Process each repository
for file in `ls $MEDIA`; do
- if [ -d "$MEDIA/$file/.git/annex" ]; then
+ if [ -d "$MEDIA/$file/.git" ]; then
(
echo Processing "$MEDIA/$file..."
cd $MEDIA/$file
+
+ if [ ! -d "$MEDIA/$file/.git/annex" ]; then
+ git annex init $HOST
+ fi
+
echo "Removing origin..."
git remote rm origin
git annex init $VOLUME