forked from Aspen-Discovery/aspen-discovery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_sideload.sh
64 lines (55 loc) · 1.52 KB
/
setup_sideload.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
60
61
62
63
64
#!/bin/bash
#
# author Pascal Brammeier
#
#-------------------------------------------------------------------------
# SideLoad Data Directory Set up Script
#-------------------------------------------------------------------------
COLLECTION=$1
LIBRARY=$2
DIR=/data/vufind-plus
if [ $# = 2 ] || [ $# = 3 ];then
echo ""
echo "The Side Load Collection is: $COLLECTION"
echo "The Library is: $LIBRARY"
if [ $# = 3 ];then
LOCATION=$3
echo "The Location is: $LOCATION"
fi
echo ""
#Check that Collection Dir Exists; if not, create
DIR+="/$COLLECTION"
if [ ! -d "$DIR" ]; then
echo "Creating $DIR"
mkdir "$DIR"
fi
#Check that Library Dir Exists, if does exit with error; if not create dir
DIR+="/$LIBRARY"
if [ ! -d "$DIR" ]; then
echo "Creating $DIR"
mkdir "$DIR"
fi
if [ $# = 3 ];then
DIR+="/$LOCATION"
echo "Creating $DIR"
mkdir "$DIR"
LIBRARY+="\/$LOCATION"
# escape directory slash for sed replacement
fi
echo "The Side Load Data Directory is: $DIR"
#copy sideload data dir structure to path
echo "Copying template data directories"
cp -r /usr/local/vufind-plus/data_dir_setup/sideload_data_dir_template/* $DIR
#edit the merge configuration file
echo "Update mergeConfig.ini file"
sed -i "s/SIDELOADCOLLECTION/$COLLECTION/g" $DIR/mergeConfig.ini
sed -i "s/LIBRARY/$LIBRARY/g" $DIR/mergeConfig.ini
else
echo ""
echo "Usage: $0 {SideLoadCollection} {Library} {Location (optional)}"
echo "eg: $0 learning_express evld"
echo ""
exit 1
fi
#
#--eof--