]> gitweb.fluxo.info Git - puppet-backup.git/commitdiff
Adding --fsck option to sync-media
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 31 Dec 2012 18:13:07 +0000 (16:13 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 31 Dec 2012 18:13:07 +0000 (16:13 -0200)
files/sync-media

index f80f1e8448564e91378785b1b2ded19e10e574c2..37bc6c2b2e9f04996fb29505a370d1e7f5bf47d0 100755 (executable)
@@ -9,12 +9,18 @@ DOMAIN="`facter domain`"
 MEDIA="media.$DOMAIN"
 INCOMING="$CACHE/incoming"
 WHOAMI="`whoami`"
+OPTIONS="$*"
 
 # Set sudo config
 if [ "$WHOAMI" != 'root' ]; then
   sudo="sudo"
 fi
 
+# Set fsck config
+if echo $OPTIONS | grep -q "--fsck"; then
+  FSCK="true"
+fi
+
 # Commit changes
 if [ -d "$CACHE" ]; then
   # Fix cache permissions
@@ -61,7 +67,11 @@ if [ -d "$CACHE" ]; then
       done
 
       git annex sync
-      git annex fsck --fast
+
+      if [ "$FSCK" == "true" ]; then
+        git annex fsck --fast
+      fi
+
       git annex unused
       git annex dropunused 1-1000
       )
@@ -103,7 +113,11 @@ if [ -d "$VOLUME/$MEDIA" ]; then
       echo "Syncing $VOLUME/$MEDIA/$folder..."
       git annex sync
       git annex get --auto --numcopies=3
-      git annex fsck --fast
+
+      if [ "$FSCK" == "true" ]; then
+        git annex fsck --fast
+      fi
+
       git annex unused
       git annex dropunused 1-1000
       #git annex drop --auto --numcopies=2