]> gitweb.fluxo.info Git - puppet-backup.git/commitdiff
Adding sync_media_add and adding files from removable media
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 8 Jan 2013 01:11:22 +0000 (23:11 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 8 Jan 2013 01:11:22 +0000 (23:11 -0200)
files/sync-media

index b41b1336b796927cb661b47613acde93b37ea712..4a99263f758ae5c12f2aabe635effe61234d819d 100755 (executable)
@@ -11,6 +11,33 @@ INCOMING="$CACHE/incoming"
 WHOAMI="`whoami`"
 OPTIONS="$*"
 
+# Add files into the annex
+function sync_media_add {
+  git annex add .
+
+  # Adding hidden files and symlinks, find version
+  #find -name '.*' -exec git annex add {} \;
+  #find -type l -exec git add {} \;
+
+  # Adding hidden files and symlinks, git+for version
+  #for file in `git status --porcelain -u | sed -e 's/?? //'`; do
+  #  if [ -h "$file" ]; then
+  #    git add $file
+  #  else
+  #    git annex add $file
+  #  fi
+  #done
+
+  # Adding hidden files and symlinks, git+while version
+  git status --porcelain -u | sed -e 's/?? //' | while read file; do
+    if [ -h "$file" ]; then
+      git add "$file"
+    else
+      git annex add "$file"
+    fi
+  done
+}
+
 # Set sudo config
 if [ "$WHOAMI" != 'root' ]; then
   sudo="sudo"
@@ -42,30 +69,7 @@ if [ -d "$CACHE" ]; then
       (
       cd $CACHE/$folder
       echo "Syncing $CACHE/$folder..."
-      git annex add .
-
-      # Adding hidden files and symlinks, find version
-      #find -name '.*' -exec git annex add {} \;
-      #find -type l -exec git add {} \;
-
-      # Adding hidden files and symlinks, git+for version
-      #for file in `git status --porcelain -u | sed -e 's/?? //'`; do
-      #  if [ -h "$file" ]; then
-      #    git add $file
-      #  else
-      #    git annex add $file
-      #  fi
-      #done
-
-      # Adding hidden files and symlinks, git+while version
-      git status --porcelain -u | sed -e 's/?? //' | while read file; do
-        if [ -h "$file" ]; then
-          git add "$file"
-        else
-          git annex add "$file"
-        fi
-      done
-
+      sync_media_add
       git annex sync
 
       if [ "$FSCK" == "true" ]; then
@@ -111,6 +115,7 @@ if [ -d "$VOLUME/$MEDIA" ]; then
       (
       cd $VOLUME/$MEDIA/$folder
       echo "Syncing $VOLUME/$MEDIA/$folder..."
+      sync_media_add
       git annex sync
       git annex get --auto --numcopies=3