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