Replace -u option with per-repo "usmb" tag

This commit is contained in:
Rob Pearce 2019-03-17 14:56:24 +11:00
parent cb6c7139a7
commit b6786c25b1
1 changed files with 10 additions and 8 deletions

14
bare.sh
View File

@ -23,7 +23,6 @@ LOG=/dev/stdout
DATE=/bin/date
DOALL=0
REPOSTOBACKUP=""
USEUSMB=0
function log() {
local now
@ -62,7 +61,6 @@ function usage() {
echo " -x num Use 'num' simultaneous connections (default: 20)"
echo " -c Cron mode - log to ${LOGFILE}"
echo " -t Test mode - dump what would be done then exit."
echo " -u Unmount (via usmb) local dir when done."
echo ""
echo "Valid commands are:"
echo " $VALIDCOMMANDS"
@ -114,7 +112,7 @@ function checktag() { # return 0 if tag matches
}
# Handle args
ARGS="acdhs:tux:"
ARGS="acdhs:tx:"
while getopts "$ARGS" i; do
case "$i" in
@ -138,9 +136,6 @@ while getopts "$ARGS" i; do
t)
TESTMODE=1
;;
u)
USEUSMB=1
;;
*)
echo "ERROR: invalid argument: $i";
usage;
@ -236,7 +231,14 @@ fi
# Validate repos
for f in $REPOSTOBACKUP; do
DATAPATH=$(getdatapath $f)
checktag "$f" usmb
if [[ $? -eq 0 ]]; then
USMBNAME=`echo "${DATAPATH}" | sed -e "s,${USMB_PREFIX}/\(.*\)/.*,\1,"`
USEUSMB=1
else
USMBNAME=""
USEUSMB=0
fi
if [[ -z $DATAPATH ]]; then
log "can't find matching repo for $f - make sure it is listed in ${REPOFILE}"