When doing premount, check whether mountpoint is already mounted first.
This commit is contained in:
parent
fbaadd8e18
commit
01af0ca438
28
bare.sh
28
bare.sh
|
@ -438,6 +438,20 @@ function restorecmd_help() {
|
|||
echo
|
||||
}
|
||||
|
||||
function is_mounted() {
|
||||
local dir dev1 dev2 rv
|
||||
dir="$1"
|
||||
dev1=$(stat -f %d $dir 2>/dev/null)
|
||||
dev2=$(stat -f %d $dir/.. 2>/dev/null)
|
||||
if [[ $dev1 == $dev2 ]]; then
|
||||
rv=1
|
||||
else
|
||||
rv=0
|
||||
fi
|
||||
return $rv
|
||||
|
||||
}
|
||||
|
||||
# Handle args
|
||||
ARGS="acd:hs:tvx:"
|
||||
|
||||
|
@ -806,12 +820,16 @@ for f in $REPO_LIST; do
|
|||
if [[ $MOUNTREPO -eq 1 ]]; then
|
||||
path=`gettagval "$f" premount`
|
||||
[[ $VERBOSE -eq 1 ]] && log "debug: doing repo premount at $path via fstab"
|
||||
mount $path
|
||||
if [[ $? -eq 0 ]]; then
|
||||
log "Pre-mount of '$path': success"
|
||||
if is_mounted $path; then
|
||||
log "Pre-mount of '$path': already mounted"
|
||||
else
|
||||
log "Pre-mount of '$path': FAILED"
|
||||
continue
|
||||
mount $path
|
||||
if [[ $? -eq 0 ]]; then
|
||||
log "Pre-mount of '$path': success"
|
||||
else
|
||||
log "Pre-mount of '$path': FAILED"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue