opengeodb-installer

raw

install_opengeodb.sh

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
#!/bin/bash
 
# - INSTALL instructions:
# mkdir /your/preferred/path/opengeodb
# cd /your/preferred/path/opengeodb
# - copy this script to install_opengeodb.sh
# - make script executable:
# chmod +x install_opengeodb.sh
# - edit you mysql credentials
#
# IMPORTANT:
# This script uses wget to retrieve requested files, verify that wget is installed on your system.
#
# before you start installing opengeodb you have to download:
# setup_innodb_geodb.sql from gist https://gist.github.com/3942251 in the same directory than this script
# or
# setup_myisam_geodb.sql from gist https://gist.github.com/3942244 in the same directory than this script
# and
# CREATE_ZIP_SQL from gist https://gist.github.com/3942008 as create_zip.sql in the same directory than this script
#
 
#
# start install process:
# ./install_opengeodb.sh
 
# edit your mysql credentials
DB=dbname
DB_USER=dbuser
DB_PASS=xxx
 
# do not touch
URL=http://fa-technik.adfc.de/code/opengeodb/
ALTER_SQL=opengeodb-end.sql
EXTRA_SQL=extra.sql
CREATE_ZIP_SQL=create_zip.sql
# CREATE_ZIP_SQL from gist https://gist.github.com/3942008
 
read -n1 -p "This script is installing the opengeodb schema and is importing lot of data. Do you really want to proceed? y|n " key
echo
case $key in
"Y" | "y") true ;;
"N" | "n") echo 'Installation aborted'; exit;;
*) exit; echo ' ' ;;
esac
 
read -p "Do you want to install a InnoDB or MyISAM driven opengeodb driven schema? [myisam] " engine
case "$engine" in
        innodb) SCHEMA=setup_innodb_geodb.sql
                echo "creating InnoDB opengeodb schema"
                echo " "
        ;;
        *)      SCHEMA=setup_myisam_geodb.sql
                echo "creating MyISAM opengeodb schema" 
                echo " "
        ;;
esac
 
mysql -u $DB_USER -p $DB_PASS $DB < $SCHEMA
 
read -p "Which country data do you want to import? (comma separated) [AT,BE,CH,DE,LI] " country
 
if [ "$country" == "" ]; then
        country="AT,BE,CH,DE,LI"
fi
 
IFS=','
for sql in $country
do
        echo "downloading $sql.sql"
        wget $URL$sql.sql
        echo "importing $sql data"
        mysql -u $DB_USER -p $DB_PASS $DB < $sql.sql
done
 
echo "Downloading metadata, creating indices"
wget $URL$ALTER_SQL
echo "Inserting metadata, creating indices"
mysql -u $DB_USER -p $DB_PASS $DB < $ALTER_SQL
 
read -p "Do you want to install extra information (Höhenangaben, Kontinente, Daten mit Versionierung etc.)? y|n " extra
echo
case $extra in
"Y" | "y")      echo "Downloading $EXTRA_SQL"
                wget $URL$EXTRA_SQL
                echo "Inserting extra informations"
                mysql -u $DB_USER -p $DB_PASS $DB < $EXTRA_SQL
;;
*)      echo "No extra data will be installed"
;;
esac
 
read -p "Do you want to install hierachy informations? y|n " location
echo
case $location in
"Y" | "y")      echo "Downloading hierarchy data for selected countries"
                for sql in $country
                do
                        echo "Downloading ${sql}hier.sql"
                        wget $URL${sql}hier.sql
                        echo "Importing ${sql}hier data"
                        mysql -u $DB_USER -p $DB_PASS $DB < ${sql}hier.sql
                done
;;
*)      echo "No hierachy data will be installed"
;;
esac
 
read -p "Do you want to create a single zip table for better radius search? y|n " single
echo
case $single in
"Y" | "y")      echo "Installing zip table"
                mysql -u $DB_USER -p $DB_PASS $DB < $CREATE_ZIP_SQL
;;
*)      echo "No zip table will be installed"
;;
esac
 
echo
echo "Installing opengeodb finished"
echo
Anonymous Anonymous
owner

Fork of

untitled repository

History