Project

General

Profile

1
#!/bin/bash
2
# Imports all inputs at once
3

    
4
import_all_main ()
5
{
6
    local self="${BASH_SOURCE[0]}"
7
    local selfDir="$(dirname -- "$self")"
8
    cd "$selfDir/.."
9
    
10
    if test "${BASH_LINENO[1]}" = 0; then # was run without initial "."
11
        echo "Usage: . $self [vars...] (note initial \".\")"|fold -s >&2
12
        return 2
13
    fi
14
    
15
    make inputs/.TNRS/tnrs_accepted/reinstall
16
    make inputs/.TNRS/tnrs_other/reinstall
17
    
18
    all=1; . "$selfDir/with_all" Source/import by_col=1 "$@"
19
        # note that this isn't affected by $import_source
20
    wait # wait for asynchronous commands
21
    unset all
22
    
23
    export import_source= # Source tables have already been imported
24
    
25
    make inputs/.herbaria/import "$@" &
26
    sleep 5 # wait for make commands to scroll by
27
    
28
    make inputs/.geoscrub/import "$@" &
29
    sleep 5 # wait for make commands to scroll by
30
    
31
    make inputs/.NCBI/import by_col=1 "$@"
32
    # Must come after NCBI for cross links to be made
33
    make inputs/.TNRS/import "$@"
34
    
35
    wait # wait for asynchronous commands
36
    
37
    make inputs/.TNRS/tnrs/tnrs-remake wait=1 "$@" &
38
    . "$selfDir/with_all" import "$@"
39
    
40
    after_import ()
41
    {
42
        bin/make_analytical_db
43
    }
44
    
45
    jobs="$(jobs -p)"
46
    (bin/waitpid $jobs; after_import) &
47
    
48
    unset import_source
49
}
50
import_all_main "$@"
(26-26/69)