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