aboutsummaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-07 23:11:22 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-07 23:11:22 -0200
commit96362fdeca3eaeb56e733598db491ab8902c5364 (patch)
tree2716dcb015b80f7a37d5e6b5eabd357e43beb20b /files
parentb3ddd8b72dd56eea060065414cc506731f7de0de (diff)
downloadpuppet-backup-96362fdeca3eaeb56e733598db491ab8902c5364.tar.gz
puppet-backup-96362fdeca3eaeb56e733598db491ab8902c5364.tar.bz2
Adding sync_media_add and adding files from removable media
Diffstat (limited to 'files')
-rwxr-xr-xfiles/sync-media53
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