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