Skip to content

Commit

Permalink
use DECK SERIAL as a backup if the ltfs gives no TAPE SERIAL
Browse files Browse the repository at this point in the history
  • Loading branch information
dericed authored Aug 4, 2016
1 parent 661dbf7 commit 9bce6cc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mountlto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9bce6cc

Please sign in to comment.