-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
69 lines (50 loc) · 1.63 KB
/
Copy pathinstall.sh
File metadata and controls
69 lines (50 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash -x
#
# This script install the Table Translation Framework in the
# PostgreSQL folder to be installed as en extension.
#
# Copy the configSample.bat file to config.bat and
# and edit the path to your PostgreSQL installation.
# Once installed you can install the extension in your database by doing:
#
# CREATE EXTENSION IF NOT EXISTS table_translation_framework;
#
# and deinstall bu doing:
#
# DROP EXTENSION IF EXISTS table_translation_framework;
#
ext_name=table_translation_framework
scriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Load config variables from local config file
# Load config variables from local config file
if [ -f $scriptDir/config.sh ]; then
source $scriptDir/config.sh
else
echo ERROR: NO config.sh FILE
exit 1
fi
ctrl_file="$pghome/share/extension/$ext_name.control"
sql_file="$pghome/share/extension/$ext_name--$tt_version.sql"
# Create the table_translation_framework.control file
cat > "$ctrl_file" <<- EOM
# table translation framework
comment = 'Translate a table into another table using a translation table.'
default_version = '$tt_version'
relocatable = false
EOM
# Create the table_translation_framework.sql file
cat > "$sql_file" <<- EOM
/* $ext_name--$tt_version.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION $ext_name;" to load this file. \quit
-- Engine part --
EOM
cat engine.sql >> "$sql_file"
cat >> "$sql_file" <<- EOM
-- Helper Functions Part --
EOM
cat helperFunctions.sql >> "$sql_file"
cat >> "$sql_file" <<- EOM
-- GIS Helper functions part --
EOM
cat helperFunctionsGIS.sql >> "$sql_file"