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 6382 aaronmk
    make inputs/.herbaria/import "$@" &
19
    sleep 5 # wait for make commands to scroll by
20
21 5957 aaronmk
    make inputs/.geoscrub/import "$@" &
22 5959 aaronmk
    sleep 5 # wait for make commands to scroll by
23
24 5836 aaronmk
    make inputs/.NCBI/import by_col=1 "$@"
25 5943 aaronmk
    # Must come after NCBI for cross links to be made
26 5957 aaronmk
    make inputs/.TNRS/import "$@"
27 5959 aaronmk
28 6382 aaronmk
    wait %1 # wait for asynchronous commands
29 5503 aaronmk
30 5836 aaronmk
    make inputs/.TNRS/tnrs/tnrs-remake wait=1 "$@" &
31 5039 aaronmk
    . "$selfDir/with_all" import "$@"
32 6210 aaronmk
33
    after_import ()
34
    {
35
        bin/make_analytical_db
36
    }
37
38
    jobs="$(jobs -p)"
39 6211 aaronmk
    (bin/waitpid $jobs; after_import) &
40 1952 aaronmk
}
41
import_all_main "$@"