-
Notifications
You must be signed in to change notification settings - Fork 9
/
migrate.sh
executable file
·110 lines (99 loc) · 5.73 KB
/
migrate.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
#
# This script is just a helper wrapper for transform.pl so one can run the whole shizang with one shebang.
#
#Override MMT_HOME to support multiple pipelines on one control/transformation machine
test ! -z $1 && MMT_HOME=$1
MMT_CONFIG="$MMT_HOME/config/main.yaml"
echo "MMT_HOME='$MMT_HOME'"
echo -e "Log output uses shell colouring. Remember to set your reader to accept the colour codes.\n \$> less -Rr <file>\n"
test ! -e "$MMT_CONFIG" && echo "\$MMT_CONFIG=$MMT_CONFIG doesn't exist. Aborting!" exit 2
SOURCE_SYSTEM=$(perl -e "use YAML; \$yaml = YAML::LoadFile('$MMT_CONFIG'); print \$yaml->{sourceSystemType};")
test -z "$SOURCE_SYSTEM" && echo "'sourceSystemType' is unknown. Couldn't parse it from \$MMT_CONFIG=$MMT_CONFIG. Aborting!" exit 3
LOG_DIR="$MMT_HOME/logs"
DATA_SOURCE_DIR="$MMT_HOME/${SOURCE_SYSTEM}Exports/"
function pii_finder {
grep --color="always" -Pnr "\d\d\d\d\d\d[-+A]\d\d\d\w" $DATA_SOURCE_DIR/* &> $LOG_DIR/00-pii.log
}
if [[ "$SOURCE_SYSTEM" =~ "Voyager" ]]; then
echo "--extract"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --extract &> $LOG_DIR/01-extract.log
echo "--biblios"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --biblios &> $LOG_DIR/02-biblios.log
echo "--holdings"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --holdings &> $LOG_DIR/03-holdings.log
echo "--items"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --items &> $LOG_DIR/04-items.log
echo "--patrons"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --patrons &> $LOG_DIR/05-patrons.log
echo "--issues"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --issues &> $LOG_DIR/06-issues.log
echo "--fines"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --fines &> $LOG_DIR/07-fines.log
echo "--reserves"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --reserves &> $LOG_DIR/08-reserves.log
echo "--serials"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --serials &> $LOG_DIR/09-serials.log
echo "--subscriptions"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --subscriptions &> $LOG_DIR/10-subscriptions.log
echo "--branchtransfers"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --branchtransfers &> $LOG_DIR/11-branchtransfers.log
echo "--load"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --load &> $LOG_DIR/12-load.log
fi
if [[ "$SOURCE_SYSTEM" =~ "PrettyLib" ]]; then
echo "--extract"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --extract &> $LOG_DIR/00-extract.log
echo "--biblios"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --biblios &> $LOG_DIR/01-biblios.log
echo "--items"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --items &> $LOG_DIR/02-items.log
echo "--patrons"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --patrons &> $LOG_DIR/03-patrons.log
echo "--issues"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --issues &> $LOG_DIR/04-issues.log
echo "--fines"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --fines &> $LOG_DIR/05-fines.log
echo "--booksellers"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --booksellers &> $LOG_DIR/06-booksellers.log
echo "--history"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --history &> $LOG_DIR/07-history.log
echo "--reserves"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --reserves &> $LOG_DIR/10-reserves.log
echo "--load"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --load &> $LOG_DIR/11-load.log
fi
if [[ "$SOURCE_SYSTEM" =~ "PrettyCirc" ]]; then
echo "--extract"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --extract &> $LOG_DIR/00-extract.log
echo "--biblios"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --biblios &> $LOG_DIR/01-biblios.log
echo "--items"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --items &> $LOG_DIR/02-items.log
echo "--patrons"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --patrons &> $LOG_DIR/03-patrons.log
echo "--issues"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --issues &> $LOG_DIR/04-issues.log
echo "--fines"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --fines &> $LOG_DIR/05-fines.log
echo "--booksellers"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --booksellers &> $LOG_DIR/06-booksellers.log
echo "--subscriptions"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --subscriptions &> $LOG_DIR/08-subscriptions.log
echo "--serials"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --serials &> $LOG_DIR/09-serials.log
echo "--routinglists"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --routinglists &> $LOG_DIR/10-routinglists.log
echo "--reserves"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --reserves &> $LOG_DIR/11-reserves.log
echo "--load"
MMT_HOME="$MMT_HOME" perl -Itransformer transformer/transform.pl --load &> $LOG_DIR/12-load.log
fi
echo ""
echo "Data migration pipeline complete."
echo "Please carefully check all the logs in the log directory '$LOG_DIR'"
echo "Also logs are available in the Koha-instance's /home/koha/KohaMigration/bulk*.log"
echo ""
echo ""
echo "Thank you!"
echo ""