-
Notifications
You must be signed in to change notification settings - Fork 8
/
ingestschemas
executable file
·37 lines (32 loc) · 1.06 KB
/
ingestschemas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
# ingestschemas
# This script imports already existing information to the database (LTO schema
# information). It can be run either on individual files or on directories
# containing multiple files.
SCRIPTDIR=$(dirname $(command -v "${0}"))
. "${SCRIPTDIR}/mmfunctions" || { echo "Missing '${SCRIPTDIR}/mmfunctions'. Exiting." ; exit 1 ; }
if [ -z "${PREMIS_NAME}" ] || [ "${PREMIS_DB}" != "Y" ] ; then
echo "Please configure database options in mmconfig. Exiting"
fi
if [ -d "${1}" ] ; then
cd "${1}"
for i in *.schema ; do
xmlschema="${i}"
echo "Ingesting ${i}"
MEDIA_ID=$(basename "${xmlschema}" | cut -d'.' -f1)
eventType="ingest"
_report_to_db
_report_schema_db
_eventoutcome_update
done
elif [ -f "${1}" ] ; then
xmlschema="${1}"
MEDIA_ID=$(basename "${xmlschema}" | cut -d'.' -f1)
eventType="ingest"
echo "Ingesting ${1}"
_report_to_db
_report_schema_db
_eventoutcome_update
else
Echo "Please use a valid directory for input. Exiting" && exit 1
fi