diff options
Diffstat (limited to 'files')
-rwxr-xr-x | files/sync-media | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/files/sync-media b/files/sync-media index b41b133..4a99263 100755 --- a/files/sync-media +++ b/files/sync-media @@ -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 |