diff --git a/bare.sh b/bare.sh index 3db5831..0bb82be 100755 --- a/bare.sh +++ b/bare.sh @@ -477,6 +477,18 @@ function check_repomount_needed() { return 0 } +function check_datamount_needed() { + if [[ $CMD == "go" ]]; then + NEEDMOUNT=1 + elif [[ $CMD == "get" ]]; then + NEEDMOUNT=1 + elif [[ $CMD == "diff" ]]; then + NEEDMOUNT=1 + else + NEEDMOUNT=0 + fi +} + # Handle args ARGS="acd:hs:tTvx:" @@ -748,6 +760,7 @@ for f in $REPO_LIST; do fi fi + check_datamount_needed "$f" # sets $NEEDMOUNT if [[ $CMD == "go" ]]; then NEEDMOUNT=1 elif [[ $CMD == "get" ]]; then @@ -835,15 +848,7 @@ for f in $REPO_LIST; do else USINGDEFAULT=1 fi - if [[ $CMD == "go" ]]; then - NEEDMOUNT=1 - elif [[ $CMD == "get" ]]; then - NEEDMOUNT=1 - elif [[ $CMD == "diff" ]]; then - NEEDMOUNT=1 - else - NEEDMOUNT=0 - fi + check_datamount_needed "$f" # sets $NEEDMOUNT check_repomount_needed "$f" # sets $MOUNTREPO if [[ $MOUNTREPO -eq 1 ]]; then @@ -1383,11 +1388,6 @@ for f in $REPO_LIST; do fi fi - if [[ $NEEDMOUNT -eq 1 ]]; then - do_umount - fi - - if [[ ! $CMD == "check" ]]; then # Record result updatestats $f $CMD $rv @@ -1405,6 +1405,11 @@ done # Clean up for f in $REPO_LIST; do + check_datamount_needed "$f" # sets $NEEDMOUNT + if [[ $NEEDMOUNT -eq 1 ]]; then + do_umount + fi + check_repomount_needed "$f" # sets $MOUNTREPO if [[ $MOUNTREPO -eq 1 ]]; then path=`gettagval "$f" premount`