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