1
|
#!/bin/bash
|
2
|
# Runs map with BIEN defaults
|
3
|
|
4
|
selfDir="$(dirname -- "$0")"
|
5
|
bin="$selfDir/bin"
|
6
|
|
7
|
shopt -s nullglob
|
8
|
|
9
|
bien_password="$(cat "$selfDir/config/bien_password")"
|
10
|
|
11
|
# VegBIEN DB defaults
|
12
|
prefix=in_
|
13
|
test "$in_database" = vegbien && . "$bin/vegbien_dest"
|
14
|
unset prefix
|
15
|
test "$out_database" = vegbien && . "$bin/vegbien_dest"
|
16
|
|
17
|
# Other defaults
|
18
|
if test -n "$in_engine"; then
|
19
|
test -n "$in_host" || export in_host=localhost
|
20
|
if test -z "$in_user"; then
|
21
|
if test _"$(hostname)" = _nimoy -a _"$in_engine" = _MySQL; then
|
22
|
. "$bin/env_password" mysql_password "your MySQL password" || exit
|
23
|
# exit this script if password not set
|
24
|
export in_user="$USER" in_password="$mysql_password"
|
25
|
if test "$in_database" = SALVIAS; then in_database=salvias_plots
|
26
|
else in_database=bien2_staging
|
27
|
fi
|
28
|
else
|
29
|
export in_user=bien in_password="$bien_password"
|
30
|
fi
|
31
|
fi
|
32
|
fi
|
33
|
|
34
|
# User overrides
|
35
|
if test -n "$public" -a -n "$out_schemas"; then # append custom public schema
|
36
|
out_schemas="$out_schemas,$public"
|
37
|
if test "$in_database" = "$out_database" -a -n "$in_schemas"; then
|
38
|
in_schemas="$in_schemas,$public"
|
39
|
fi
|
40
|
fi
|
41
|
|
42
|
exec "$bin/map" "$@"
|