1 |
1551
|
aaronmk
|
#!/bin/bash
|
2 |
1541
|
aaronmk
|
# Imports all inputs at once
|
3 |
|
|
|
4 |
1952
|
aaronmk
|
import_all_main ()
|
5 |
|
|
{
|
6 |
|
|
local self="${BASH_SOURCE[0]}"
|
7 |
|
|
local selfDir="$(dirname -- "$self")"
|
8 |
6211
|
aaronmk
|
cd "$selfDir/.."
|
9 |
1952
|
aaronmk
|
|
10 |
1953
|
aaronmk
|
if test "${BASH_LINENO[1]}" = 0; then # was run without initial "."
|
11 |
6946
|
aaronmk
|
echo "Usage: [version=...;] . $self [vars...] (note initial \".\")"\
|
12 |
|
|
|fold -s >&2
|
13 |
1952
|
aaronmk
|
return 2
|
14 |
|
|
fi
|
15 |
6946
|
aaronmk
|
: ${version=$(make -s version)}
|
16 |
|
|
export version
|
17 |
1952
|
aaronmk
|
|
18 |
5917
|
aaronmk
|
make inputs/.TNRS/tnrs_accepted/reinstall
|
19 |
|
|
make inputs/.TNRS/tnrs_other/reinstall
|
20 |
5503
|
aaronmk
|
|
21 |
6946
|
aaronmk
|
make schemas/$version/install
|
22 |
|
|
|
23 |
6896
|
aaronmk
|
all=1; . "$selfDir/with_all" Source/import by_col=1 "$@"
|
24 |
6897
|
aaronmk
|
# note that this isn't affected by $import_source
|
25 |
6593
|
aaronmk
|
wait # wait for asynchronous commands
|
26 |
6896
|
aaronmk
|
unset all
|
27 |
6593
|
aaronmk
|
|
28 |
6897
|
aaronmk
|
export import_source= # Source tables have already been imported
|
29 |
|
|
|
30 |
6382
|
aaronmk
|
make inputs/.herbaria/import "$@" &
|
31 |
|
|
sleep 5 # wait for make commands to scroll by
|
32 |
|
|
|
33 |
5957
|
aaronmk
|
make inputs/.geoscrub/import "$@" &
|
34 |
5959
|
aaronmk
|
sleep 5 # wait for make commands to scroll by
|
35 |
|
|
|
36 |
5836
|
aaronmk
|
make inputs/.NCBI/import by_col=1 "$@"
|
37 |
5943
|
aaronmk
|
# Must come after NCBI for cross links to be made
|
38 |
5957
|
aaronmk
|
make inputs/.TNRS/import "$@"
|
39 |
5959
|
aaronmk
|
|
40 |
6594
|
aaronmk
|
wait # wait for asynchronous commands
|
41 |
5503
|
aaronmk
|
|
42 |
5836
|
aaronmk
|
make inputs/.TNRS/tnrs/tnrs-remake wait=1 "$@" &
|
43 |
6897
|
aaronmk
|
. "$selfDir/with_all" import "$@"
|
44 |
6210
|
aaronmk
|
|
45 |
|
|
after_import ()
|
46 |
|
|
{
|
47 |
|
|
bin/make_analytical_db
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
jobs="$(jobs -p)"
|
51 |
6211
|
aaronmk
|
(bin/waitpid $jobs; after_import) &
|
52 |
6897
|
aaronmk
|
|
53 |
|
|
unset import_source
|
54 |
1952
|
aaronmk
|
}
|
55 |
|
|
import_all_main "$@"
|