Add localmount tag to mount dir via fstab before action.
This commit is contained in:
parent
b50a3be2c4
commit
1f48477940
35
bare.sh
35
bare.sh
|
@ -62,6 +62,7 @@ function usage-repo() {
|
|||
echo " from start of repo path."
|
||||
echo " usmb Run 'usmb reponame' to mount \$USMB_PREFIX/<sharename> before running."
|
||||
echo " Sharename determined by stripping \$NFS_PREFIX from start of <repopath>."
|
||||
echo " localmount Run 'mount reponame' to mount <path_to_files> before running."
|
||||
}
|
||||
function usage-rc() {
|
||||
echo " export B2_ACCOUNT_ID=xxx # Backblaze B2 credentials"
|
||||
|
@ -252,6 +253,9 @@ function do_umount() {
|
|||
elif [[ $USENFS -eq 1 ]]; then
|
||||
log "Unmounting nfs volume '$NFSPATH' from $DATAPATH"
|
||||
umount $DATAPATH
|
||||
elif [[ $USELOCALMOUNT -eq 1 ]]; then
|
||||
log "Unmounting dir $DATAPATH"
|
||||
umount $DATAPATH
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -439,6 +443,17 @@ for f in $REPOSTOBACKUP; do
|
|||
NFSNAME=""
|
||||
USENFS=0
|
||||
fi
|
||||
checktag "$f" localmount
|
||||
if [[ $? -eq 0 ]]; then
|
||||
grep -q $DTAPATH /etc/fstab
|
||||
if [[ $? -ne 0 ]]; then
|
||||
log "Error: repo '$REPO' has localmount tag but $DATAPATH not in fstab."
|
||||
continue
|
||||
fi
|
||||
USELOCALMOUNT=1
|
||||
else
|
||||
USELOCALMOUNT=0
|
||||
fi
|
||||
|
||||
if [[ -z $DATAPATH ]]; then
|
||||
log "can't find matching repo for $f - make sure it is listed in ${REPOFILE}"
|
||||
|
@ -479,6 +494,19 @@ for f in $REPOSTOBACKUP; do
|
|||
continue
|
||||
fi
|
||||
fi
|
||||
elif [[ $USELOCALMOUNT -eq 1 ]]; then
|
||||
mount | grep -q ${DATAPATH}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
# try mounting it.
|
||||
mkdir -p $DATAPATH
|
||||
mount ${DATAPATH} >/dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
log "Mount $DATAPATH: success"
|
||||
else
|
||||
log "Mount $DATAPATH: FAILED"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! [[ -e ${DATAPATH} ]]; then
|
||||
|
@ -547,6 +575,13 @@ for f in $REPOSTOBACKUP; do
|
|||
USENFS=0
|
||||
fi
|
||||
|
||||
checktag "$f" localmount
|
||||
if [[ $? -eq 0 ]]; then
|
||||
USELOCALMOUNT=1
|
||||
else
|
||||
USELOCALMOUNT=0
|
||||
fi
|
||||
|
||||
|
||||
export REPO_PATH=`getrepopath "$f"`
|
||||
if [[ $? -eq 0 ]]; then
|
||||
|
|
Loading…
Reference in New Issue