1 |
1975
|
aaronmk
|
#!/bin/bash
|
2 |
243
|
aaronmk
|
|
3 |
1973
|
aaronmk
|
vegbien_dest_main ()
|
4 |
|
|
{
|
5 |
|
|
local self="${BASH_SOURCE[0]}"
|
6 |
|
|
local selfDir="$(dirname -- "$self")"
|
7 |
|
|
|
8 |
1977
|
aaronmk
|
# Was run without initial "."
|
9 |
|
|
if test "${BASH_LINENO[1]}" = 0 -a "${BASH_ARGV[0]}" != "$self"; then
|
10 |
1973
|
aaronmk
|
echo "Usage: . $self (note initial \".\")"|fold -s >&2
|
11 |
|
|
return 2
|
12 |
|
|
fi
|
13 |
|
|
|
14 |
6949
|
aaronmk
|
: ${prefix=} ${version=public} ${public=$version}
|
15 |
1973
|
aaronmk
|
|
16 |
6947
|
aaronmk
|
export version public \
|
17 |
1973
|
aaronmk
|
${prefix}engine=PostgreSQL \
|
18 |
|
|
${prefix}host=localhost \
|
19 |
|
|
${prefix}user=bien \
|
20 |
|
|
${prefix}password="$(cat "$selfDir/../config/bien_password")" \
|
21 |
2102
|
aaronmk
|
${prefix}database=vegbien \
|
22 |
12989
|
aaronmk
|
${prefix}schemas="temp${public:+,$public,${public}_validations},TNRS,util,py_util"
|
23 |
7066
|
aaronmk
|
|
24 |
|
|
# Schema override for referring to a table in the $public schema
|
25 |
|
|
local schemaVar=${prefix}schema tableVar=${prefix}table
|
26 |
7094
|
aaronmk
|
if test -n "${!schemaVar}" -a -n "${!tableVar}"; then
|
27 |
7066
|
aaronmk
|
local tableTable="${!tableVar#public.}"
|
28 |
|
|
if test "$tableTable" != "${!tableVar}"; then # had prefix
|
29 |
|
|
export $tableVar="$tableTable" $schemaVar="$public"
|
30 |
|
|
fi
|
31 |
|
|
fi
|
32 |
1973
|
aaronmk
|
}
|
33 |
|
|
vegbien_dest_main "$@"
|