Project

General

Profile

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 5039 aaronmk
        echo "Usage: . $self [vars...] (note initial \".\")"|fold -s >&2
12 1952 aaronmk
        return 2
13
    fi
14
15 5917 aaronmk
    make inputs/.TNRS/tnrs_accepted/reinstall
16
    make inputs/.TNRS/tnrs_other/reinstall
17 5503 aaronmk
18 6896 aaronmk
    all=1; . "$selfDir/with_all" Source/import by_col=1 "$@"
19 6897 aaronmk
        # note that this isn't affected by $import_source
20 6593 aaronmk
    wait # wait for asynchronous commands
21 6896 aaronmk
    unset all
22 6593 aaronmk
23 6897 aaronmk
    export import_source= # Source tables have already been imported
24
25 6382 aaronmk
    make inputs/.herbaria/import "$@" &
26
    sleep 5 # wait for make commands to scroll by
27
28 5957 aaronmk
    make inputs/.geoscrub/import "$@" &
29 5959 aaronmk
    sleep 5 # wait for make commands to scroll by
30
31 5836 aaronmk
    make inputs/.NCBI/import by_col=1 "$@"
32 5943 aaronmk
    # Must come after NCBI for cross links to be made
33 5957 aaronmk
    make inputs/.TNRS/import "$@"
34 5959 aaronmk
35 6594 aaronmk
    wait # wait for asynchronous commands
36 5503 aaronmk
37 5836 aaronmk
    make inputs/.TNRS/tnrs/tnrs-remake wait=1 "$@" &
38 6897 aaronmk
    . "$selfDir/with_all" import "$@"
39 6210 aaronmk
40
    after_import ()
41
    {
42
        bin/make_analytical_db
43
    }
44
45
    jobs="$(jobs -p)"
46 6211 aaronmk
    (bin/waitpid $jobs; after_import) &
47 6897 aaronmk
48
    unset import_source
49 1952 aaronmk
}
50
import_all_main "$@"