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
|
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
|
# Handle args
|
||||||
ARGS="acd:hs:tvx:"
|
ARGS="acd:hs:tvx:"
|
||||||
|
|
||||||
|
@ -806,12 +820,16 @@ for f in $REPO_LIST; do
|
||||||
if [[ $MOUNTREPO -eq 1 ]]; then
|
if [[ $MOUNTREPO -eq 1 ]]; then
|
||||||
path=`gettagval "$f" premount`
|
path=`gettagval "$f" premount`
|
||||||
[[ $VERBOSE -eq 1 ]] && log "debug: doing repo premount at $path via fstab"
|
[[ $VERBOSE -eq 1 ]] && log "debug: doing repo premount at $path via fstab"
|
||||||
mount $path
|
if is_mounted $path; then
|
||||||
if [[ $? -eq 0 ]]; then
|
log "Pre-mount of '$path': already mounted"
|
||||||
log "Pre-mount of '$path': success"
|
|
||||||
else
|
else
|
||||||
log "Pre-mount of '$path': FAILED"
|
mount $path
|
||||||
continue
|
if [[ $? -eq 0 ]]; then
|
||||||
|
log "Pre-mount of '$path': success"
|
||||||
|
else
|
||||||
|
log "Pre-mount of '$path': FAILED"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue