2010-01-26 02:38:01 -08:00
|
|
|
#!/bin/sh
|
2018-03-22 08:04:53 -07:00
|
|
|
#############################################################################
|
|
|
|
#
|
2022-06-08 04:02:35 -07:00
|
|
|
# Purpose: This script will OpenLayers 6 (and OpenLayers 2.13.1 for legacy
|
2018-03-22 08:04:53 -07:00
|
|
|
# demos in OSGeoLive)
|
|
|
|
#
|
|
|
|
#############################################################################
|
2022-06-08 04:02:35 -07:00
|
|
|
# Copyright (c) 2009-2022 The Open Source Geospatial Foundation and others.
|
2013-07-19 19:46:32 -07:00
|
|
|
# Licensed under the GNU LGPL version >= 2.1.
|
2010-01-26 02:38:01 -08:00
|
|
|
#
|
|
|
|
# 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".
|
2018-03-22 08:04:53 -07:00
|
|
|
#############################################################################
|
|
|
|
|
2010-01-26 02:38:01 -08:00
|
|
|
# Running:
|
|
|
|
# =======
|
|
|
|
# sudo service apache2 start
|
2014-12-25 09:12:13 -08:00
|
|
|
# Then open a web browser and go to http://localhost/ol3/
|
2010-01-26 02:38:01 -08:00
|
|
|
|
2013-07-19 19:46:32 -07:00
|
|
|
./diskspace_probe.sh "`basename $0`" begin
|
2014-12-29 14:54:34 -08:00
|
|
|
BUILD_DIR=`pwd`
|
2013-07-19 19:46:32 -07:00
|
|
|
####
|
2012-08-07 16:47:08 -07:00
|
|
|
|
2012-06-02 16:33:25 -07:00
|
|
|
if [ -z "$USER_NAME" ] ; then
|
|
|
|
USER_NAME="user"
|
|
|
|
fi
|
2010-08-03 00:26:25 -07:00
|
|
|
USER_HOME="/home/$USER_NAME"
|
2013-07-19 19:46:32 -07:00
|
|
|
TMP_DIR="/tmp/build_openlayers"
|
2015-07-20 04:24:03 -07:00
|
|
|
|
2014-12-25 09:12:13 -08:00
|
|
|
OL2_VERSION="2.13.1"
|
2017-05-30 00:57:19 -07:00
|
|
|
OL2_DIR=/var/www/html/ol2
|
2014-12-25 09:12:13 -08:00
|
|
|
|
2022-06-08 04:02:35 -07:00
|
|
|
OPENLAYERS_VERSION="6.14.1"
|
2017-05-30 00:57:19 -07:00
|
|
|
OPENLAYERS_DIR=/var/www/html/openlayers
|
2015-07-20 04:24:03 -07:00
|
|
|
|
2014-12-25 09:12:13 -08:00
|
|
|
#
|
|
|
|
# Install OpenLayers 2
|
|
|
|
#
|
|
|
|
echo "\nCreating temporary directory $TMP_DIR..."
|
|
|
|
mkdir -p "$TMP_DIR"
|
|
|
|
echo "\nCreating OpenLayers2 directory $OL2_DIR..."
|
|
|
|
mkdir -p "$OL2_DIR"
|
2017-05-30 00:57:19 -07:00
|
|
|
echo "\nCreating OpenLayers directory $OPENLAYERS_DIR..."
|
|
|
|
mkdir -p "$OPENLAYERS_DIR"
|
2014-12-25 09:12:13 -08:00
|
|
|
|
|
|
|
echo "\nDownloading OpenLayers2..."
|
|
|
|
cd "$TMP_DIR"
|
2014-12-25 09:20:20 -08:00
|
|
|
if [ -f "OpenLayers-$OL2_VERSION.tar.gz" ]
|
|
|
|
then
|
|
|
|
echo "OpenLayers-$OL2_VERSION.tar.gz has already been downloaded."
|
|
|
|
else
|
|
|
|
wget -c --progress=dot:mega \
|
2017-05-30 00:57:19 -07:00
|
|
|
"http://github.com/openlayers/ol2/releases/download/release-$OL2_VERSION/OpenLayers-$OL2_VERSION.tar.gz"
|
2014-12-25 09:20:20 -08:00
|
|
|
fi
|
2014-12-25 09:12:13 -08:00
|
|
|
|
|
|
|
echo "\nInstalling OpenLayers2..."
|
2014-12-28 11:49:40 -08:00
|
|
|
tar zxf "OpenLayers-$OL2_VERSION.tar.gz"
|
2014-12-25 09:12:13 -08:00
|
|
|
cd "OpenLayers-$OL2_VERSION"
|
|
|
|
mv OpenLayers.js "$OL2_DIR"/
|
|
|
|
mv img "$OL2_DIR"/
|
|
|
|
mv theme "$OL2_DIR"/
|
|
|
|
chmod -R uga+r "$OL2_DIR"
|
|
|
|
|
2014-12-25 09:20:20 -08:00
|
|
|
echo "\nCleaning up..."
|
2014-12-25 09:12:13 -08:00
|
|
|
cd "$TMP_DIR"
|
|
|
|
rm -rf "OpenLayers-$OL2_VERSION"
|
|
|
|
rm "OpenLayers-$OL2_VERSION.tar.gz"
|
|
|
|
|
|
|
|
#
|
2017-05-30 00:57:19 -07:00
|
|
|
# Install OpenLayers
|
2014-12-25 09:12:13 -08:00
|
|
|
#
|
2017-05-30 00:57:19 -07:00
|
|
|
echo "\nInstalling OpenLayers..."
|
2015-07-20 04:24:03 -07:00
|
|
|
|
|
|
|
cd "$TMP_DIR"
|
|
|
|
|
2017-05-30 00:57:19 -07:00
|
|
|
OPENLAYERS_ARCHIVE_FULL="v$OPENLAYERS_VERSION.zip"
|
|
|
|
if [ -f "$OPENLAYERS_ARCHIVE_FULL" ]
|
2015-07-20 04:24:03 -07:00
|
|
|
then
|
2017-05-30 00:57:19 -07:00
|
|
|
echo "OpenLayers $OPENLAYERS_VERSION full version has already been downloaded. Skipping download."
|
2015-07-20 04:24:03 -07:00
|
|
|
else
|
|
|
|
wget -c --progress=dot:mega \
|
2017-05-30 00:57:19 -07:00
|
|
|
"https://github.com/openlayers/openlayers/releases/download/v$OPENLAYERS_VERSION/v$OPENLAYERS_VERSION.zip"
|
|
|
|
echo "OpenLayers $OPENLAYERS_VERSION full version download complete."
|
2015-07-20 04:24:03 -07:00
|
|
|
fi
|
|
|
|
|
2017-05-30 00:57:19 -07:00
|
|
|
OPENLAYERS_ARCHIVE_DIST="v$OPENLAYERS_VERSION-dist.zip"
|
|
|
|
if [ -f "$OPENLAYERS_ARCHIVE_DIST" ]
|
2015-07-20 04:24:03 -07:00
|
|
|
then
|
2017-05-30 00:57:19 -07:00
|
|
|
echo "OpenLayers $OPENLAYERS_VERSION distribution version has already been downloaded. Skipping download."
|
2015-07-20 04:24:03 -07:00
|
|
|
else
|
|
|
|
wget -c --progress=dot:mega \
|
2017-05-30 00:57:19 -07:00
|
|
|
"https://github.com/openlayers/openlayers/releases/download/v$OPENLAYERS_VERSION/v$OPENLAYERS_VERSION-dist.zip"
|
|
|
|
echo "OpenLayers $OPENLAYERS_VERSION distribution version download complete."
|
2015-07-20 04:24:03 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Unzip
|
|
|
|
#
|
|
|
|
echo "\nUnzipping archive..."
|
2017-05-30 00:57:19 -07:00
|
|
|
unzip -qo $OPENLAYERS_ARCHIVE_FULL
|
|
|
|
unzip -qo $OPENLAYERS_ARCHIVE_DIST
|
2015-07-20 04:24:03 -07:00
|
|
|
echo "Unzipping done"
|
|
|
|
|
2017-05-30 01:30:53 -07:00
|
|
|
#
|
|
|
|
# Replace assets url and workshop url
|
|
|
|
#
|
|
|
|
sed -i 's/..\/..\/..\/assets/https:\/\/openlayers.org\/assets/g' v$OPENLAYERS_VERSION/doc/*.html
|
|
|
|
sed -i 's/..\/..\/..\/..\/assets/https:\/\/openlayers.org\/assets/g' v$OPENLAYERS_VERSION/doc/**/*.html
|
|
|
|
sed -i 's/\/workshop\//https:\/\/openlayers.org\/workshop\//g' v$OPENLAYERS_VERSION/doc/index.html
|
|
|
|
|
2015-07-20 04:24:03 -07:00
|
|
|
#
|
|
|
|
# Copy to www
|
|
|
|
#
|
2017-05-30 00:57:19 -07:00
|
|
|
echo "\nCopying files to $OPENLAYERS_DIR"
|
|
|
|
rsync -r v$OPENLAYERS_VERSION/* $OPENLAYERS_DIR
|
|
|
|
rsync -r v$OPENLAYERS_VERSION-dist/* $OPENLAYERS_DIR/dist
|
2015-07-20 04:24:03 -07:00
|
|
|
echo "Copying done"
|
2013-07-15 04:35:48 -07:00
|
|
|
|
2014-12-11 22:40:29 -08:00
|
|
|
#
|
|
|
|
# Generate index page
|
|
|
|
#
|
2017-05-30 00:57:19 -07:00
|
|
|
cd "$OPENLAYERS_DIR"
|
2014-12-11 22:40:29 -08:00
|
|
|
|
2014-12-21 10:46:08 -08:00
|
|
|
echo "\nGenerating index file..."
|
2013-07-15 04:35:48 -07:00
|
|
|
cat << EOF > "index.html"
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
|
|
|
</head>
|
|
|
|
<body>
|
2017-05-30 00:57:19 -07:00
|
|
|
<h1>OpenLayers $OPENLAYERS_VERSION</h1>
|
2014-12-21 10:46:08 -08:00
|
|
|
<p>Welcome to OpenLayers index page:</p>
|
2013-07-15 04:35:48 -07:00
|
|
|
<ul>
|
2014-12-21 10:46:08 -08:00
|
|
|
<li><a href="apidoc/">API Docs</a>: explore the project documentation</li>
|
|
|
|
<li><a href="examples/">Examples</a>: see the project in action</li>
|
2017-05-30 00:57:19 -07:00
|
|
|
<li><a href="https://openlayers.org/">OpenLayers.org website</a></li>
|
2013-07-15 04:35:48 -07:00
|
|
|
</ul>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
EOF
|
2015-07-20 04:24:03 -07:00
|
|
|
echo "Index file generation done"
|
2013-07-15 04:35:48 -07:00
|
|
|
|
2014-12-11 22:40:29 -08:00
|
|
|
#
|
|
|
|
# Launch script and icon for OpenLayers to take you to a documentation
|
|
|
|
# page and examples listing
|
|
|
|
#
|
2014-12-21 10:46:08 -08:00
|
|
|
echo "\nGenerating launcher..."
|
2017-05-30 00:57:19 -07:00
|
|
|
cp "$OPENLAYERS_DIR/apidoc/logo-70x70.png" /usr/share/pixmaps/openlayers.png
|
2010-08-03 00:23:51 -07:00
|
|
|
|
|
|
|
if [ ! -e /usr/share/applications/openlayers.desktop ] ; then
|
|
|
|
cat << EOF > /usr/share/applications/openlayers.desktop
|
|
|
|
[Desktop Entry]
|
|
|
|
Type=Application
|
|
|
|
Encoding=UTF-8
|
2014-02-25 02:35:12 -08:00
|
|
|
Name=OpenLayers
|
2010-08-03 00:23:51 -07:00
|
|
|
Comment=Sample constructions
|
|
|
|
Categories=Application;Internet;
|
2017-05-30 00:57:19 -07:00
|
|
|
Exec=firefox http://localhost/openlayers/ http://localhost/osgeolive/en/quickstart/openlayers_quickstart.html
|
2010-08-03 00:23:51 -07:00
|
|
|
Icon=openlayers
|
|
|
|
Terminal=false
|
|
|
|
StartupNotify=false
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
cp /usr/share/applications/openlayers.desktop "$USER_HOME/Desktop/"
|
2012-08-07 03:39:24 -07:00
|
|
|
chown "$USER_NAME:$USER_NAME" "$USER_HOME/Desktop/openlayers.desktop"
|
2010-08-03 00:23:51 -07:00
|
|
|
|
2013-07-19 19:46:32 -07:00
|
|
|
####
|
2014-12-29 14:54:34 -08:00
|
|
|
"$BUILD_DIR"/diskspace_probe.sh "`basename $0`" end
|