Skip to content

Commit

Permalink
add LTO-8 to regex (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
retokromer authored Jan 14, 2018
1 parent 0e79e74 commit 424ab59
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
7 changes: 3 additions & 4 deletions formatlto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

SCRIPTDIR=$(dirname "${0}")
DEPENDENCIES=(mkltfs mmfunctions)
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[567])?$"
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[5-8])?$"
BLUE="$(tput setaf 4)" # Blue - For Questions
NC="$(tput sgr0)" # No Color

Expand Down Expand Up @@ -63,8 +63,7 @@ fi
if [[ "${#LTO_ARRAY[@]}" -gt 1 ]] ; then
PS3="${BLUE}Which LTO deck?${NC} "
eval set "${LTO_ARRAY[@]}"
select DECK in "$@"
do
select DECK in "$@" ; do
break
done
if [ ! "${DECK}" ] ; then
Expand All @@ -83,7 +82,7 @@ fi
_report -qn "Enter the tape identifier: "
read TAPE_ID
if [[ ! $(echo "${TAPE_ID}" | grep -E "${TAPE_SERIAL_REGEX}") ]] ; then
_report -w "Error: The tape id must be exactly 6 capital letters and/or numbers, possibly followed by 'L5', 'L6' or 'L7' specifying the LTO generation."
_report -w "Error: The tape id must be exactly 6 capital letters and/or numbers, possibly followed by 'L5', 'L6', 'L7' or 'L8' specifying the LTO generation."
exit 1
fi
mkltfs ${MIDDLE_OPTIONS[@]} --device=${DECK} --tape-serial="${TAPE_ID}" --volume-name="${TAPE_ID}"
6 changes: 3 additions & 3 deletions mountlto
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fi

_report -d "Checking for ready tapes..."

for i in $(seq 1 "$LTO_COUNT") ; do
for i in $(seq 1 "${LTO_COUNT}") ; do
DECK=$(echo "$i - 1" | bc)
if [ $(which ltfs_ldun) ] ; then
ltfs_ldun load ${DECK} 1>/dev/null
Expand All @@ -38,7 +38,7 @@ for i in $(seq 1 "$LTO_COUNT") ; do
unset TAPE_SERIAL
COUNTER=0
echo -n "Checking for tape barcode"
while [[ "${#TAPE_SERIAL}" -lt "${MINIMUM_TAPE_SERIAL_LENGTH}" ]] && [[ "$COUNTER" -lt 5 ]]; do
while [[ "${#TAPE_SERIAL}" -lt "${MINIMUM_TAPE_SERIAL_LENGTH}" ]] && [[ "${COUNTER}" -lt 5 ]]; do
let COUNTER=COUNTER+1
ltfs -f -o devname="${DECK}" 2> "${LOADTMP}"
# find barcode by either "Volser(Barcode)" (Quantum style) or "Tape attribute: Barcode" (IBM style)
Expand All @@ -48,7 +48,7 @@ for i in $(seq 1 "$LTO_COUNT") ; do
echo
if [[ "${#TAPE_SERIAL}" -lt "${MINIMUM_TAPE_SERIAL_LENGTH}" ]] ; then
if [[ $(cat "${LOADTMP}" | grep -a "Mounting the volume") && ! $(cat "${LOADTMP}" | grep -a "failed to load the tape") ]] ; then
DECKSERIAL=$(cat "$LOADTMP" | grep -a -o "serial number is [A-Z0-9]*" | awk '{print $4}')
DECKSERIAL=$(cat "${LOADTMP}" | grep -a -o "serial number is [A-Z0-9]*" | awk '{print $4}')
TAPE_SERIAL="${DECKSERIAL}"
else
unset TAPE_SERIAL
Expand Down
4 changes: 2 additions & 2 deletions readlto
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
SCRIPTDIR=$(dirname "${0}")
DEPENDENCIES=(gcp)
TAPE_MOUNT_POINT="/Volumes"
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[567])?$"
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[5-8])?$"
TAPE_EJECT="Y"

. "${SCRIPTDIR}/mmfunctions" || { echo "Missing '${SCRIPTDIR}/mmfunctions'. Exiting." ; exit 1 ; }
Expand Down Expand Up @@ -43,7 +43,7 @@ shift $(( ${OPTIND} - 1 ))

TARGET="${1}"
if [[ ! $(echo "${TAPE_SERIAL}" | grep -E "${TAPE_SERIAL_REGEX}") ]] ; then
echo "${TAPE_SERIAL} is not valid. The tape id must be exactly 6 capital letters and/or numbers, possibly followed by 'L5', 'L6' or 'L7' specifying the LTO generation."
echo "${TAPE_SERIAL} is not valid. The tape id must be exactly 6 capital letters and/or numbers, possibly followed by 'L5', 'L6', 'L7' or 'L8' specifying the LTO generation."
exit 1
fi

Expand Down
4 changes: 2 additions & 2 deletions verifylto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
SCRIPTDIR=$(dirname "${0}")
. "${SCRIPTDIR}/mmfunctions" || { echo "Missing '${SCRIPTDIR}/mmfunctions'. Exiting." ; exit 1 ; }
TAPE_MOUNT_POINT="/Volumes"
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[567])?$"
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[5-8])?$"
_check_for_lto_index_dir
LTO_LOGS="${LTO_INDEX_DIR}"
TAPE_EJECT="Y"
Expand Down Expand Up @@ -50,7 +50,7 @@ if [[ "${PREMIS_DB}" = "Y" ]] ; then
_report_to_db
fi
if [[ ! $(echo "${TAPE_SERIAL}" | grep -E "${TAPE_SERIAL_REGEX}") ]] ; then
echo "${TAPE_SERIAL} is not valid. The tape id must be exactly 6 capital letters and/or numbers, possibly followed by 'L5', 'L6' or 'L7' specifying the LTO generation."
echo "${TAPE_SERIAL} is not valid. The tape id must be exactly 6 capital letters and/or numbers, possibly followed by 'L5', 'L6', 'L7' or 'L8' specifying the LTO generation."
exit 1
fi

Expand Down
4 changes: 2 additions & 2 deletions writelto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SCRIPTDIR=$(dirname "${0}")
. "${SCRIPTDIR}/mmfunctions" || { echo "Missing '${SCRIPTDIR}/mmfunctions'. Exiting." ; exit 1 ; }
DEPENDENCIES=(gcp mmfunctions)
TAPE_MOUNT_POINT="/Volumes"
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[567])?$"
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[5-8])?$"
unset HIDDEN_FILES
TAPE_EJECT="Y"
_check_for_lto_index_dir
Expand Down Expand Up @@ -59,7 +59,7 @@ shift $(( ${OPTIND} - 1 ))

SOURCE_DIR="${1}"
if [[ ! $(echo "${TAPE_SERIAL}" | grep -E "${TAPE_SERIAL_REGEX}") ]] ; then
_report -w "Tape serial ${TAPE_SERIAL} is not valid. The tape id must be exactly 6 capital letters and/or numbers, possibly followed by 'L5', 'L6' or 'L7' specifying the LTO generation."
_report -w "Tape serial ${TAPE_SERIAL} is not valid. The tape id must be exactly 6 capital letters and/or numbers, possibly followed by 'L5', 'L6', 'L7' or 'L8' specifying the LTO generation."
_report -w "Proceeding with non-standard Tape Serial"
fi
# Check for colons in filenames of source directory.
Expand Down

0 comments on commit 424ab59

Please sign in to comment.