diff --git a/README.md b/README.md index d891f27..288356b 100755 --- a/README.md +++ b/README.md @@ -45,21 +45,6 @@ The script will format your tape in LTFS format, with no compression, and sets r **Remember to physically label the tape with the tape id!** -##Set Configuration## - -If this is the first time you are running the LTO scripts, you must first edit the configuration file. - -**Run ltoperconfig script.** - -**Follow the prompts to edit the following variables:** - -``` -FILEMAKER_USER=XXXXX -FILEMAKER_PASS=XXXXX -FILEMAKER_DB=XXXXX -FILEMAKER_XML_URL=xxx.xxx/xxx.xml -``` - ##Mounting LTO & Creating XMLs## **Put tape you want to mount in the deck (you do not have to push it in all the way).** @@ -78,8 +63,6 @@ Tape will load in deck and mount. Whenever a tape is ejected, the script will export the tape’s index (as an xml .schema file) to $HOME/Documents/lto_indexes on your computer. If a .schema file for that tape already exists in that location, it will just update the existing schema file with any new data. -The mountlto script will then prompt the lto2filemaker script to run. - ##Writing LTO## **To write data onto a tape, run the writelto script.** @@ -88,17 +71,7 @@ The mountlto script will then prompt the lto2filemaker script to run. The script will run rsync twice the transfer the data to the LTO tape. It runs twice to address an unresolved problem with small-sized files not transferring properly (running it twice seems to fix the errors). - -##Writing LTO metadata to FileMaker## - -This process happens automatically via the lto2filemaker script, which runs when the user unmounts the LTO tape using the mountlto script. Using XML Starlet, the lto2filemaker script parses the xml documents and sends the metadata to the lto\_tapes and lto\_files tables in FileMaker. - -Lto2filemaker can also be invoked independently: - -`$lto2filemaker yourfile.schema` - ##Tools## -- ltoperconfig - mountlto - formatlto - writelto @@ -107,7 +80,6 @@ Lto2filemaker can also be invoked independently: - ingestschemas - indexschemas - renameschemas -- lto2filemaker (requires XMLStarlet) ##External locations of LTO scripts and related tools:## https://github.com/amiaopensource/ltopers diff --git a/lto2filemaker b/lto2filemaker deleted file mode 100755 index 4e3cb57..0000000 --- a/lto2filemaker +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env bash - -# lto2filemaker -# This script presumes that you've setup a filemaker database with Filemaker -# Server using two tables called "lto_tapes" and "lto_files" with fields -# according to the LTFS XML format. - -VERSION="0.9" -SCRIPTDIR=$(dirname "${0}") -REQUIRECONFIG="Y" -DEPENDENCIES=(xml curl) -unset CURL_OPTS -VERBOSITY=0 - -. "${SCRIPTDIR}/mmfunctions" || { echo "Missing '${SCRIPTDIR}/mmfunctions'. Exiting." ; exit 1 ; } - -_usage(){ -cat < "${LTO_TAPE_TMP}" - -CURL_OUTPUT=$(_maketemp) - -CURL_OPTS+=(-S) -CURL_OPTS+=(-o "${CURL_OUTPUT}") - -while read TAPE ; do - if [[ "${TAPE}" ]] ; then - TAPE_CMD="curl ${CURL_OPTS[@]} -G "${TAPE}" \"http://"${FILEMAKER_XML_URL}"?-db="${FILEMAKER_DB}"&-lay=lto_tapes&-new\"" - TAPE_ID=$(echo "${TAPE}" | grep -o "name=[^ ]*" | sed 's/"//g') - _report -d "Uploading tape metadata for tape "${TAPE_ID}". Please wait…" - eval "${TAPE_CMD}" - ERROR_CODE=$(xml sel -t -m /_:fmresultset/_:error -v @code "${CURL_OUTPUT}" 2>/dev/null) - if [[ "${ERROR_CODE}" == 404 ]] ; then - _report -d "The database is not responding." - elif [[ "${ERROR_CODE}" == 504 ]] ; then - _report -d "The database already knows about: ${SCHEMA_NAME}" - elif [[ -z "${ERROR_CODE}" ]] ; then - _report -d "There is an error in uploading ${SCHEMA_NAME}:" - cat "${CURL_OUTPUT}" - elif [[ "${ERROR_CODE}" != 0 ]] ; then - _report -d "Warning error code ${ERROR_CODE} from database while uploading the tape record of ${SCHEMA_NAME}." - fi - fi -done < "${LTO_TAPE_TMP}" -_report -d "Uploading file metadata for tape "${TAPE_ID}". Please wait…" - -LTO_FILE_TMP=$(_maketemp) -xml sel -t -m ".//file" -o " --data-urlencode \"name=" -v name -o "\" --data-urlencode \"length=" -v "length" -o "\" --data-urlencode \"path=" -m "ancestor-or-self::directory" -v "name" -o "/" -b -v name -o "\" --data-urlencode \"readonly=" -v readonly -o "\" --data-urlencode \"creationtime=" -v creationtime -o "\" --data-urlencode \"changetime=" -v changetime -o "\" --data-urlencode \"modifytime=" -v modifytime -o "\" --data-urlencode \"accesstime=" -v accesstime -o "\" --data-urlencode \"backuptime=" -v backuptime -o "\" --data-urlencode \"fileuid=" -v fileuid -o "\" --data-urlencode \"uniq=" -v fileuid -o "." -v modifytime -o "." -v length -o "." -v name -o "\"" -n "${SCHEMA_FILE}" > "${LTO_FILE_TMP}" - -while read FILE ; do - if [[ "${FILE}" ]] ; then - FILE_CMD="curl ${CURL_OPTS[@]} -G "${FILE}" \"http://${FILEMAKER_XML_URL}?-db=${FILEMAKER_DB}&-lay=lto_files&-new\" ${REDIRECT}" - FILE_ID=$(echo "${FILE}" | grep -o "name=[^ ]*" | sed 's/"//g') - eval "${FILE_CMD}" - ERROR_CODE=$(xml sel -t -m /_:fmresultset/_:error -v @code "${CURL_OUTPUT}" 2>/dev/null) - if [[ "${ERROR_CODE}" == 404 ]] ; then - _report -w "The database is not responding." - elif [[ "${ERROR_CODE}" == 504 ]] ; then - _report -d "The database already knows about a file in ${SCHEMA_NAME} called $FILE_ID" - elif [[ -z "${ERROR_CODE}" ]] ; then - _report -d "There is an error in uploading ${SCHEMA_NAME}:" - cat "${CURL_OUTPUT}" - echo - elif [[ "${ERROR_CODE}" != 0 ]] ; then - _report -w "Warning error code ${ERROR_CODE} from database while uploading a file record of ${SCHEMA_NAME}." - fi - fi -done < "${LTO_FILE_TMP}" -_report -d "Done uploading metadata for ${TAPE_ID}." diff --git a/ltoperconfig b/ltoperconfig deleted file mode 100755 index f3cee2a..0000000 --- a/ltoperconfig +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env bash - -# ltoperconfig -# set up variables - -CONFIG_VERSION="0.9" -SCRIPTDIR=$(dirname "${0}") -CONFIG="Y" -LTO_CONFIG_FILE="${SCRIPTDIR}/ltoper.conf" - -. "${SCRIPTDIR}/mmfunctions" || { echo "Missing '${SCRIPTDIR}/mmfunctions'. Exiting." ; exit 1 ; } - -if [ -f "${LTO_CONFIG_FILE}" ] ; then - . "${LTO_CONFIG_FILE}" -else - touch "${LTO_CONFIG_FILE}" -fi - -conf=" -# Set transparency: 0 is transparent, 1 is opaque -*.transparency=1.00 - -# Set window title -*.title = LTOPERS - -# intro text -intro.x = 20 -intro.y = 500 -intro.width = 500 -intro.type = text -intro.text = LTO configuration options. Leave the option blank to be prompted. - -# username to the filemaker database -FILEMAKER_USER.x = 20 -FILEMAKER_USER.y = 440 -FILEMAKER_USER.type = textfield -FILEMAKER_USER.label = Please enter your filemaker username: -FILEMAKER_USER.width = 270 -FILEMAKER_USER.default = "${FILEMAKER_USER}" - -# password to filemaker -FILEMAKER_PASS.x = 20 -FILEMAKER_PASS.y = 390 -FILEMAKER_PASS.type = textfield -FILEMAKER_PASS.label = Please enter your filemaker password: -FILEMAKER_PASS.width = 270 -FILEMAKER_PASS.default = "${FILEMAKER_PASS}" - -# Name of the filemaker database -FILEMAKER_DB.x = 20 -FILEMAKER_DB.y = 340 -FILEMAKER_DB.type = textfield -FILEMAKER_DB.label = Please enter the name of the filemaker database: -FILEMAKER_DB.width = 270 -FILEMAKER_DB.default = "${FILEMAKER_DB}" - -# filemaker xml url -FILEMAKER_XML_URL.x = 20 -FILEMAKER_XML_URL.y = 280 -FILEMAKER_XML_URL.type = textfield -FILEMAKER_XML_URL.label = Please enter the filemaker XML URL: -FILEMAKER_XML_URL.width = 270 -FILEMAKER_XML_URL.default = "${FILEMAKER_XML_URL}" - -# Add a cancel button with default label -cb.type=cancelbutton - -"; - -#comments must be commented (start with #) -config_comment="# Set each value to empty quotes (like \"\") to prompt during run, or set to a provided option." -FILEMAKER_USER_COMMENT="# Set the filemaker username: $(printf "\"%s\" " "${FILEMAKER_USER[@]}")" -FILEMAKER_PASS_COMMENT="#Set the filemaker password: $(printf "\"%s\" " "${FILEMAKER_PASS[@]}")" -FILEMAKER_DB_COMMENT="#Set the name of the filemaker database: $(printf "\"%s\" " "${FILEMAKER_DB[@]}")" -FILEMAKER_XML_URL_COMMENT="#Set the filemaker xml url: $(printf "\"%s\" " "${FILEMAKER_XML_URL[@]}")" - -pashua_configfile=$(/usr/bin/mktemp /tmp/pashua_XXXXXXXXX) -echo "${conf}" > "${pashua_configfile}" -_pashua_run -rm "${pashua_configfile}" - -if [[ "$cb" = 0 ]] ; then - #report back options -cat < "${LTO_CONFIG_FILE}" <