forked from OSGeo/OSGeoLive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_geonetwork.sh
executable file
·154 lines (131 loc) · 4.83 KB
/
install_geonetwork.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/sh
#################################################
#
# Purpose: Installation of GeoNetwork into Xubuntu
# Author: Ricardo Pinho <[email protected]>
# Author: Simon Pigot <[email protected]>
# Author: Francois Prunayre <[email protected]>
# Small edits: Jeroen Ticheler <[email protected]>
#
#################################################
# Copyright (c) 2010-2016 Open Source Geospatial Foundation (OSGeo)
# Copyright (c) 2009 GISVM.COM
#
# Licensed under the GNU LGPL version >= 2.1.
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 2.1 of the License,
# or any later version. This library is distributed in the hope that
# it will be useful, but WITHOUT ANY WARRANTY, without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details, either
# in the "LICENSE.LGPL.txt" file distributed with this software or at
# web page "http://www.fsf.org/licenses/lgpl.html".
##################################################
#
# About:
# =====
# This script will install geonetwork into OSGeo live
# stable version: v3.0.1
# based on Jetty + GeoNetwork + H2
# Installed at /usr/local/lib/geonetwork
# Port number = 8880
#
# To start geonetwork
# cd /usr/local/lib/geonetwork/bin
# ./startup.sh
#
# To stop geonetwork
# cd /usr/local/lib/geonetwork/bin
# ./shutdown.sh
#
# To enter geonetwork, start browser with url:
# http://localhost:8880/geonetwork
#
# GeoNetwork version 3.0.1 runs with java 7 or higher.
# It can be installed into servlet containers: jetty and tomcat. Jetty is
# bundled with the installer.
./diskspace_probe.sh "`basename $0`" begin
BUILD_DIR=`pwd`
####
if [ -z "$USER_NAME" ] ; then
USER_NAME="user"
fi
USER_HOME="/home/$USER_NAME"
GEONETWORK_VERSION=3.0.1-0
GEONETWORK_VERSION_FOLDER=3.0.1
TMP="/tmp/build_geonetwork"
INSTALL_FOLDER="/usr/local/lib"
GEONETWORK_FOLDER="$INSTALL_FOLDER/geonetwork"
BIN="/usr/local/bin"
## Setup things... ##
# check required tools are installed
# (should we also verify java???)
if [ ! -x "`which wget`" ] ; then
echo "ERROR: wget is required, please install it and try again"
exit 1
fi
# create tmp folders
mkdir -p "$TMP"
cd "$TMP"
# get geonetwork
if [ -f "geonetwork-install-$GEONETWORK_VERSION.jar" ]
then
echo "geonetwork-install-$GEONETWORK_VERSION.jar has already been downloaded."
else
wget -c --progress=dot:mega \
"http://sourceforge.net/projects/geonetwork/files/GeoNetwork_opensource/v$GEONETWORK_VERSION_FOLDER/geonetwork-install-$GEONETWORK_VERSION.jar/download" \
-O geonetwork-install-$GEONETWORK_VERSION.jar
fi
## Get Install config files ##
# Those files contains information about default ports
# and need to be updated to properly setup the node on the OSGeo live machine
FILES="
install.xml
jetty.xml
startup.sh
shutdown.sh
data-db-default.sql
"
for FILE in $FILES ; do
cp -f -v "$BUILD_DIR/../app-conf/geonetwork/$FILE" .
done
## Install Application ##
if [ -d "$GEONETWORK_FOLDER" ] ; then
( cd "$GEONETWORK_FOLDER/bin"; ./shutdown.sh )
fi
java -jar geonetwork-install-$GEONETWORK_VERSION.jar install.xml
cp -f jetty.xml "$GEONETWORK_FOLDER/jetty/etc/jetty.xml"
cp -f data-db-default.sql "$GEONETWORK_FOLDER/web/geonetwork/WEB-INF/classes/setup/sql/data/."
cp -f wro4j-cache.* "$GEONETWORK_FOLDER/web/geonetwork/WEB-INF/data/."
cp -f startup.sh "$GEONETWORK_FOLDER/bin/startup.sh"
cp -f shutdown.sh "$GEONETWORK_FOLDER/bin/shutdown.sh"
# fix permissions on installed software
# what's really needed here? the logs for sure, the rest are guesses
chgrp users "$GEONETWORK_FOLDER"/jetty
chgrp users "$GEONETWORK_FOLDER"/jetty/logs -R
chgrp users "$GEONETWORK_FOLDER"/web/geonetwork/WEB-INF/ -R
chgrp users "$GEONETWORK_FOLDER"/web/geonetwork/images/logos
chmod g+w "$GEONETWORK_FOLDER"/jetty
chmod g+w "$GEONETWORK_FOLDER"/jetty/logs -R
chmod g+w "$GEONETWORK_FOLDER"/web/geonetwork/WEB-INF/ -R
chmod g+w "$GEONETWORK_FOLDER"/web/geonetwork/images/logos
adduser "$USER_NAME" users
# create startup, shutdown, open browser and doco desktop entries
for FILE in start_geonetwork stop_geonetwork geonetwork ; do
cp -f -v "$BUILD_DIR/../app-conf/geonetwork/$FILE.desktop" .
cp -f "$FILE.desktop" "$USER_HOME/Desktop/$FILE.desktop"
chown "$USER_NAME:$USER_NAME" "$USER_HOME/Desktop/$FILE.desktop"
done
#copy project logo to use as menu icon
cd "$TMP"
wget -c --progress=dot:mega \
"https://github.com/OSGeo/OSGeoLive-doc/raw/master/images/project_logos/logo-GeoNetwork.png" \
-O geonetwork_icon.png
mkdir -p /usr/local/share/icons
mv geonetwork_icon.png /usr/local/share/icons/geonetwork_icon.png
# No manual/doco as these are included in the geonetwork release as html
# pages
####
"$BUILD_DIR"/diskspace_probe.sh "`basename $0`" end