forked from vufind-org/vufind
-
Notifications
You must be signed in to change notification settings - Fork 1
/
import-marc-auth.sh
executable file
·59 lines (52 loc) · 1.61 KB
/
import-marc-auth.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
#
# Wrapper around import-marc.sh to allow import of authority records.
#
E_BADARGS=65
# No arguments? Display syntax:
if [ $# -eq 0 ]
then
echo " Usage: `basename $0` ./path/to/marc.mrc [properties file]"
exit $E_BADARGS
fi
##################################################
# Set VUFIND_HOME
##################################################
if [ -z "$VUFIND_HOME" ]
then
# set VUFIND_HOME to the absolute path of the directory containing this script
# https://stackoverflow.com/questions/4774054/reliable-way-for-a-bash-script-to-get-the-full-path-to-itself
export VUFIND_HOME="$(cd "$(dirname "$0")" && pwd -P)"
if [ -z "$VUFIND_HOME" ]
then
exit 1
fi
fi
# Always use the standard authority mappings; if the user specified an override
# file, add that to the setting.
if [ -f "$VUFIND_LOCAL_DIR/import/marc_auth.properties" ]
then
MAPPINGS_FILE="$VUFIND_LOCAL_DIR/import/marc_auth.properties"
else
MAPPINGS_FILE="$VUFIND_HOME/import/marc_auth.properties"
fi
if [ $# -gt 1 ]
then
if [ -f "$VUFIND_LOCAL_DIR/import/$2" ]
then
MAPPINGS_FILE="$MAPPINGS_FILE,$VUFIND_LOCAL_DIR/import/$2"
else
MAPPINGS_FILE="$MAPPINGS_FILE,$VUFIND_HOME/import/$2"
fi
fi
# Override some settings in the standard import script:
if [ -f "$VUFIND_LOCAL_DIR/import/import_auth.properties" ]
then
export PROPERTIES_FILE="$VUFIND_LOCAL_DIR/import/import_auth.properties"
else
export PROPERTIES_FILE="$VUFIND_HOME/import/import_auth.properties"
fi
export SOLRCORE="authority"
export EXTRA_SOLRMARC_SETTINGS="-Dsolr.indexer.properties=$MAPPINGS_FILE"
# Call the standard script:
$VUFIND_HOME/import-marc.sh $1