diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2012-12-31 16:13:07 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2012-12-31 16:13:07 -0200 |
commit | 15746c59df994f331aacab49b981ee04b217754f (patch) | |
tree | 414b6783bfadfca6855c862b14685bee51d3391d | |
parent | baf30b586919d52da095e9224f5dbe35b619377a (diff) | |
download | puppet-backup-15746c59df994f331aacab49b981ee04b217754f.tar.gz puppet-backup-15746c59df994f331aacab49b981ee04b217754f.tar.bz2 |
Adding --fsck option to sync-media
-rwxr-xr-x | files/sync-media | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/files/sync-media b/files/sync-media index f80f1e8..37bc6c2 100755 --- a/files/sync-media +++ b/files/sync-media @@ -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 |