Skip to content

Commit 424ab59

Browse files
authored
add LTO-8 to regex (#161)
1 parent 0e79e74 commit 424ab59

5 files changed

Lines changed: 12 additions & 13 deletions

File tree

formatlto

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

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

@@ -63,8 +63,7 @@ fi
6363
if [[ "${#LTO_ARRAY[@]}" -gt 1 ]] ; then
6464
PS3="${BLUE}Which LTO deck?${NC} "
6565
eval set "${LTO_ARRAY[@]}"
66-
select DECK in "$@"
67-
do
66+
select DECK in "$@" ; do
6867
break
6968
done
7069
if [ ! "${DECK}" ] ; then
@@ -83,7 +82,7 @@ fi
8382
_report -qn "Enter the tape identifier: "
8483
read TAPE_ID
8584
if [[ ! $(echo "${TAPE_ID}" | grep -E "${TAPE_SERIAL_REGEX}") ]] ; then
86-
_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."
85+
_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."
8786
exit 1
8887
fi
8988
mkltfs ${MIDDLE_OPTIONS[@]} --device=${DECK} --tape-serial="${TAPE_ID}" --volume-name="${TAPE_ID}"

mountlto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fi
2929

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

32-
for i in $(seq 1 "$LTO_COUNT") ; do
32+
for i in $(seq 1 "${LTO_COUNT}") ; do
3333
DECK=$(echo "$i - 1" | bc)
3434
if [ $(which ltfs_ldun) ] ; then
3535
ltfs_ldun load ${DECK} 1>/dev/null
@@ -38,7 +38,7 @@ for i in $(seq 1 "$LTO_COUNT") ; do
3838
unset TAPE_SERIAL
3939
COUNTER=0
4040
echo -n "Checking for tape barcode"
41-
while [[ "${#TAPE_SERIAL}" -lt "${MINIMUM_TAPE_SERIAL_LENGTH}" ]] && [[ "$COUNTER" -lt 5 ]]; do
41+
while [[ "${#TAPE_SERIAL}" -lt "${MINIMUM_TAPE_SERIAL_LENGTH}" ]] && [[ "${COUNTER}" -lt 5 ]]; do
4242
let COUNTER=COUNTER+1
4343
ltfs -f -o devname="${DECK}" 2> "${LOADTMP}"
4444
# find barcode by either "Volser(Barcode)" (Quantum style) or "Tape attribute: Barcode" (IBM style)
@@ -48,7 +48,7 @@ for i in $(seq 1 "$LTO_COUNT") ; do
4848
echo
4949
if [[ "${#TAPE_SERIAL}" -lt "${MINIMUM_TAPE_SERIAL_LENGTH}" ]] ; then
5050
if [[ $(cat "${LOADTMP}" | grep -a "Mounting the volume") && ! $(cat "${LOADTMP}" | grep -a "failed to load the tape") ]] ; then
51-
DECKSERIAL=$(cat "$LOADTMP" | grep -a -o "serial number is [A-Z0-9]*" | awk '{print $4}')
51+
DECKSERIAL=$(cat "${LOADTMP}" | grep -a -o "serial number is [A-Z0-9]*" | awk '{print $4}')
5252
TAPE_SERIAL="${DECKSERIAL}"
5353
else
5454
unset TAPE_SERIAL

readlto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
SCRIPTDIR=$(dirname "${0}")
77
DEPENDENCIES=(gcp)
88
TAPE_MOUNT_POINT="/Volumes"
9-
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[567])?$"
9+
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[5-8])?$"
1010
TAPE_EJECT="Y"
1111

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

4444
TARGET="${1}"
4545
if [[ ! $(echo "${TAPE_SERIAL}" | grep -E "${TAPE_SERIAL_REGEX}") ]] ; then
46-
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."
46+
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."
4747
exit 1
4848
fi
4949

verifylto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
SCRIPTDIR=$(dirname "${0}")
99
. "${SCRIPTDIR}/mmfunctions" || { echo "Missing '${SCRIPTDIR}/mmfunctions'. Exiting." ; exit 1 ; }
1010
TAPE_MOUNT_POINT="/Volumes"
11-
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[567])?$"
11+
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[5-8])?$"
1212
_check_for_lto_index_dir
1313
LTO_LOGS="${LTO_INDEX_DIR}"
1414
TAPE_EJECT="Y"
@@ -50,7 +50,7 @@ if [[ "${PREMIS_DB}" = "Y" ]] ; then
5050
_report_to_db
5151
fi
5252
if [[ ! $(echo "${TAPE_SERIAL}" | grep -E "${TAPE_SERIAL_REGEX}") ]] ; then
53-
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."
53+
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."
5454
exit 1
5555
fi
5656

writelto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ SCRIPTDIR=$(dirname "${0}")
88
. "${SCRIPTDIR}/mmfunctions" || { echo "Missing '${SCRIPTDIR}/mmfunctions'. Exiting." ; exit 1 ; }
99
DEPENDENCIES=(gcp mmfunctions)
1010
TAPE_MOUNT_POINT="/Volumes"
11-
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[567])?$"
11+
TAPE_SERIAL_REGEX="^[A-Z0-9]{6}(L[5-8])?$"
1212
unset HIDDEN_FILES
1313
TAPE_EJECT="Y"
1414
_check_for_lto_index_dir
@@ -59,7 +59,7 @@ shift $(( ${OPTIND} - 1 ))
5959

6060
SOURCE_DIR="${1}"
6161
if [[ ! $(echo "${TAPE_SERIAL}" | grep -E "${TAPE_SERIAL_REGEX}") ]] ; then
62-
_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."
62+
_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."
6363
_report -w "Proceeding with non-standard Tape Serial"
6464
fi
6565
# Check for colons in filenames of source directory.

0 commit comments

Comments
 (0)