]> gitweb.fluxo.info Git - puppet-backup.git/commitdiff
Initializing annex on sync-media-init
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 31 May 2013 18:54:43 +0000 (15:54 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 31 May 2013 18:54:43 +0000 (15:54 -0300)
files/sync-media-init

index 035da0242aee3b8b0f8460b92ac9e4c6261453eb..295da05a25d404f820de81f917702daba92e9989 100644 (file)
@@ -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