diff --git a/mountlto b/mountlto index 8139569..bcd99dd 100755 --- a/mountlto +++ b/mountlto @@ -32,7 +32,15 @@ DECK=$(echo "$i - 1" | bc) if [ $(which ltfs_ldun) ] ; then ltfs_ldun load ${DECK} 1>/dev/null fi -TAPE_SERIAL=$(ltfs -f -o devname="${DECK}" 2>&1 | grep "Volser(Barcode)" | cut -d: -f2 | awk '{print $1}') +LOADTMP=$(_maketemp) +ltfs -f -o devname="${DECK}" 2> "${LOADTMP}" +TAPE_SERIAL=$(cat "${LOADTMP}" | grep "Volser(Barcode)" | cut -d: -f2 | awk '{print $1}') +if [[ -z "$TAPE_SERIAL" ]] ; then + if [[ $(cat "${LOADTMP}" | grep "Mounting the volume") ]] ;then + DECKSERIAL=$(cat "$LOADTMP" | grep -o "serial number is [A-Za-z0-9]*" | awk '{print $4}' ) + TAPE_SERIAL="${DECKSERIAL}" + fi +fi if [[ -n "${TAPE_SERIAL}" ]] ;then echo "Deck ${DECK} found with tape ${TAPE_SERIAL}" if [[ $(uname -s) == "Darwin" ]] ; then