Newer
Older
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
#############################
# This is used to configure the behaviout of the various bootstrap scripts.
#############################
IMPORT_DATA_OSM=false
IMPORT_DATA_OSM_CACHED=false
IMPORT_DATA_SQL=true
IMPORT_SCHEDULES=true
INSTALL_GEOSERVER=false
INSTALL_HTTPD=true
# install isochrone from vagrant start directory (eclipse project)
INSTALL_ISOCHRONE_LOCAL=false
# install latest isochrone release from nexus repository
INSTALL_ISOCHRONE_RELEASE=true
# install latest isochrone snapshot from nexus repository
INSTALL_ISOCHRONE_SNAPSHOT=true
# install latest isochrone tools from nexus repository
INSTALL_ISOCHRONE_TOOLS=true
INSTALL_NEO4J=false
INSTALL_NEO4J_SPATIAL=false
INSTALL_PGROUTING=false
INSTALL_POSTGIS=true
INSTALL_POSTGRES=true
INSTALL_POSTGRES_ADMIN=true
INSTALL_PROJECT_PSIPROBE=true
CACHE_DIR_LOCAL="/tmp/vagrant-cache"
CACHE_DIR_REMOTE="http://dbis-informatik.uibk.ac.at/static/ma/niko/isochrone"
DEPLOY_DIR="/opt"
SETUP_DIR="/setup"
WORKING_DIR="/var/log/vagrant_bootstrap"
# Parameters that can also (some must) be passed as arguments
IS_LOCAL_TEST_DEPLOY=false
PG_DB_NAME="isochrone"
PG_DB_USER="@db_username@"
PG_DB_PASSWORD="@db_password@"
TOMCAT_PASSWORD="@tomcat_password@"
############################
# Calculated variables
############################
# Do not change anything below this line!
EXEC_POSTGRES="psql"
POSTGRES_SHARE="/usr/share/pgsql"
if [ ! -d ${POSTGRES_SHARE} ]; then
POSTGRES_SHARE="$(dirname /usr/pgsql*/.)""/share"
fi
AVAILABLE_GEOSERVER=$([ -d "${DEPLOY_DIR}/geoserver" ] && echo true || echo false)
AVAILABLE_NEO4J=$([ -d "${DEPLOY_DIR}/neo4j" ] && echo true || echo false)
AVAILABLE_NEO4J_SPATIAL=$([ -d "${DEPLOY_DIR}/neo4j-spatial" ] && echo true || echo false)
AVAILABLE_POSTGRES=$(type ${EXEC_POSTGRES} >/dev/null 2>&1 && echo true || echo false)
AVAILABLE_POSTGIS=$([ -f "${POSTGRES_SHARE}/extension/postgis.control" ] && echo true || echo false)
AVAILABLE_PGROUTING=$([ -f "${POSTGRES_SHARE}/extension/pgrouting.control" ] && echo true || echo false)
DOWNLOAD_DIR="${CACHE_DIR_LOCAL}/wget"
if [ ! -f "${SETUP_DIR}" ]; then
SCRIPT="$(readlink -f ${BASH_SOURCE[0]})"
SCRIPT_DIR="$(dirname ${SCRIPT})"
SETUP_DIR="$(dirname ${SCRIPT_DIR})"
fi
SHARED_CONF_DIR="${SETUP_DIR}/conf"
SHARED_IMG_DIR="${SETUP_DIR}/img"
# Function definitions
fn_arg2boolean() {
local OUTVAR="${1}"
local ARG="${2}"
local VALUE="${3}" # Default value
if [ -n "$ARG" ]; then
if [ "$ARG" == "true" ]; then
VALUE=true
else
VALUE=false
fi
fi
eval $OUTVAR="\$VALUE"
}
fn_arg2string() {
local OUTVAR="${1}"
local ARG="${2}"
local VALUE="${3}" # Default value
if [ "${VALUE:0:1}" == "@" ]; then
VALUE="${ARG}"
fi
if [ "${VALUE:0:1}" == "@" ]; then
echo '- No (or invalid) database user supplied!'
exit 1
fi
eval $OUTVAR="\$VALUE"
}
fn_download() {
local FILE="$1"
local URL="$2"
if wget --no-check-certificate -q -O /dev/null "$URL"; then
wget --no-check-certificate -q -O "$FILE" "$URL"
fi
}
fn_download_newer() {
# "wget -N" does not work with "-O" option... so we use a workaround here
local FILE="$1"
local URL="$2"
if [ ! -f "$FILE" ]; then
if wget --no-check-certificate -q -O /dev/null "$URL"; then
wget --no-check-certificate -q -O "$FILE" "$URL"
fi
fi
}