1
|
#!/bin/bash
|
2
|
# Imports all inputs at once
|
3
|
|
4
|
import_all_main ()
|
5
|
{
|
6
|
local self="${BASH_SOURCE[0]}"
|
7
|
local selfDir="$(dirname -- "$self")"
|
8
|
cd "$selfDir/.."
|
9
|
|
10
|
if test "${BASH_LINENO[1]}" = 0; then # was run without initial "."
|
11
|
echo "Usage: [version=...;] . $self [vars...] (note initial \".\")"\
|
12
|
|fold -s >&2
|
13
|
return 2
|
14
|
fi
|
15
|
: ${version=$(make -s version)}
|
16
|
local dump_opts=${dump_opts---exclude-schema=public} public_import=1
|
17
|
export version dump_opts public_import
|
18
|
|
19
|
make inputs/.TNRS/tnrs+accepted/reinstall
|
20
|
make inputs/.TNRS/tnrs_accepted/reinstall
|
21
|
make inputs/.TNRS/tnrs_other/reinstall
|
22
|
|
23
|
make schemas/$version/install
|
24
|
|
25
|
local all=1; . "$selfDir/with_all" Source/import by_col=1 "$@"
|
26
|
# note that this isn't affected by $import_source
|
27
|
wait # wait for asynchronous commands
|
28
|
unset all
|
29
|
|
30
|
local import_source= # Source tables have already been imported
|
31
|
export import_source # must come after local
|
32
|
|
33
|
make inputs/.herbaria/import "$@" &
|
34
|
sleep 5 # wait for make commands to scroll by
|
35
|
|
36
|
make inputs/.geoscrub/import "$@" &
|
37
|
sleep 5 # wait for make commands to scroll by
|
38
|
|
39
|
make inputs/.NCBI/import by_col=1 "$@"
|
40
|
# Must come after NCBI for cross links to be made
|
41
|
make inputs/.TNRS/tnrs_accepted/import "$@"
|
42
|
make inputs/.TNRS/tnrs_other/import "$@"
|
43
|
|
44
|
wait # wait for asynchronous commands
|
45
|
|
46
|
. "$selfDir/with_all" import "$@"
|
47
|
make inputs/.TNRS/tnrs/tnrs-remake wait=1 "$@" &
|
48
|
make inputs/.TNRS/public.unscrubbed_taxondetermination_view/scrub-remake \
|
49
|
wait=1 "$@" &
|
50
|
|
51
|
after_import ()
|
52
|
{
|
53
|
bin/make_analytical_db
|
54
|
|
55
|
make backups/TNRS.backup-remake &
|
56
|
make backups/vegbien.$version.backup/test & # uses $dump_opts
|
57
|
wait # wait for asynchronous commands
|
58
|
}
|
59
|
|
60
|
local jobs="$(jobs -p)"
|
61
|
(bin/waitpid $jobs; after_import) &
|
62
|
}
|
63
|
import_all_main "$@"
|