Commit 70f37fd341d2b8c134bf05c5a59a95dae20e09be
1 parent
b7a67cee
Exists in
master
and in
7 other branches
Script para instalação do i3Geo no live dvd da Osgeo
Showing
1 changed file
with
126 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,126 @@ | @@ -0,0 +1,126 @@ | ||
| 1 | +#!/bin/bash | ||
| 2 | +# Copyright (c) 2009-2010 The Open Source Geospatial Foundation. | ||
| 3 | +# Licensed under the GNU LGPL version >= 2.1. | ||
| 4 | +# | ||
| 5 | +# This library is free software; you can redistribute it and/or modify it | ||
| 6 | +# under the terms of the GNU Lesser General Public License as published | ||
| 7 | +# by the Free Software Foundation, either version 2.1 of the License, | ||
| 8 | +# or any later version. This library is distributed in the hope that | ||
| 9 | +# it will be useful, but WITHOUT ANY WARRANTY, without even the implied | ||
| 10 | +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | +# See the GNU Lesser General Public License for more details, either | ||
| 12 | +# in the "LICENSE.LGPL.txt" file distributed with this software or at | ||
| 13 | +# web page "http://www.fsf.org/licenses/lgpl.html". | ||
| 14 | +# | ||
| 15 | +# Requires: svn apache2 php5 libapache2-mod-php5 cgi-mapserver mapserver-bin php5-mapscript | ||
| 16 | +# php5-gd php5-sqlite php5-curl php5-json php5-odbc php5-pgsql php5-ps php5-xmlrpc php5-xsl php5-imagick php5-mbstring | ||
| 17 | +# | ||
| 18 | +# Uninstall: | ||
| 19 | +# ============ | ||
| 20 | +# sudo rm -rf /var/www/html/i3geo | ||
| 21 | +# sudo rm -rf /var/www/html/ms_tmp | ||
| 22 | +# sudo rm -rf /tmp/ms_tmp | ||
| 23 | + | ||
| 24 | +./diskspace_probe.sh "`basename $0`" begin | ||
| 25 | +BUILD_DIR=`pwd` | ||
| 26 | +#### | ||
| 27 | + | ||
| 28 | + | ||
| 29 | +#OSGEO live username is "user" | ||
| 30 | +if [ -z "$USER_NAME" ] ; then | ||
| 31 | + USER_NAME="user" | ||
| 32 | +fi | ||
| 33 | + | ||
| 34 | +#Repository url | ||
| 35 | +I3GEO_DOWNLOAD_URL="http://devel.gvsig.org/svn/i3geo/i3geo60/" | ||
| 36 | + | ||
| 37 | +#i3GEO dependencies | ||
| 38 | +I3GEO_DEPENDENCIES=(svn apache2 php5 libapache2-mod-php5 cgi-mapserver mapserver-bin php5-mapscript php5-gd php5-sqlite php5-curl php5-json php5-odbc php5-pgsql php5-ps php5-xmlrpc php5-xsl php5-imagick php5-mbstring) | ||
| 39 | +#R_DEPENDENCIES=(r-cran-maptools) | ||
| 40 | + | ||
| 41 | +#Installation variables | ||
| 42 | +ROOT_DIR="/var/www/html" | ||
| 43 | +TMP_DIR="/tmp" | ||
| 44 | +LOCAPLIC="$ROOT_DIR/i3geo" | ||
| 45 | + | ||
| 46 | + | ||
| 47 | +#Temporary directory, symbolic link to temporary directory | ||
| 48 | +mkdir "$TMP_DIR/ms_tmp" | ||
| 49 | +ln -s "$TMP_DIR/ms_tmp" "$ROOT_DIR/ms_tmp" | ||
| 50 | +#Temporary directory permissions | ||
| 51 | +chown -R www-data:www-data "$TMP_DIR/ms_tmp" | ||
| 52 | +chown -R www-data:www-data "$ROOT_DIR/ms_tmp" | ||
| 53 | +chmod -R 755 "$TMP_DIR/ms_tmp" | ||
| 54 | +chmod -R 755 "$ROOT_DIR/ms_tmp" | ||
| 55 | + | ||
| 56 | +#add R repository to have the latest version of R | ||
| 57 | +#cd /etc/apt/ | ||
| 58 | +#echo "deb http://cran.es.r-project.org/bin/linux/debian squeeze-cran/" >> sources.list | ||
| 59 | +#apt-key adv --keyserver subkeys.pgp.net --recv-key 381BA480 | ||
| 60 | +#apt-get update | ||
| 61 | + | ||
| 62 | +#Install i3geo dependencies | ||
| 63 | +for i in "${I3GEO_DEPENDENCIES[@]}"; do | ||
| 64 | + IS_INSTALLED=$(dpkg --get-selections | grep -w $i | grep -w install) | ||
| 65 | + if [ -z "$IS_INSTALLED" ]; then | ||
| 66 | + echo "Package $i is not installed" | ||
| 67 | + echo "Installing $i ..." | ||
| 68 | + apt-get -y install "$i" | ||
| 69 | + else | ||
| 70 | + echo "$i package is allready installed" | ||
| 71 | + fi | ||
| 72 | +done | ||
| 73 | + | ||
| 74 | +#Deploy i3geo | ||
| 75 | +echo -n "Checkout i3Geo files" | ||
| 76 | +cd "$ROOT_DIR" | ||
| 77 | +svn checkout "$I3GEO_DOWNLOAD_URL" i3geo | ||
| 78 | +echo -n "Done" | ||
| 79 | + | ||
| 80 | +#Change permissions | ||
| 81 | +cd "$ROOT_DIR" | ||
| 82 | +chown -R www-data i3geo/ | ||
| 83 | +chgrp -R www-data i3geo/ | ||
| 84 | +chmod -R 755 i3geo/ | ||
| 85 | + | ||
| 86 | + | ||
| 87 | +# Reload Apache | ||
| 88 | +/etc/init.d/apache2 force-reload | ||
| 89 | + | ||
| 90 | +### install desktop icon ## | ||
| 91 | +echo "Installing i3geo desktop icon" | ||
| 92 | +if [ ! -e "/usr/local/share/icons/i3Geo_big.png" ] ; then | ||
| 93 | + mkdir -p /usr/local/share/icons | ||
| 94 | + cp "$ROOT_DIR"/i3geo/imagens/i3Geo_big.png /usr/local/share/icons/ | ||
| 95 | +fi | ||
| 96 | + | ||
| 97 | +#Add Launch icon to desktop | ||
| 98 | +if [ ! -e /usr/local/share/applications/i3geo.desktop ] ; then | ||
| 99 | + mkdir -p /usr/local/share/applications | ||
| 100 | + cat << EOF > /usr/local/share/applications/i3geo.desktop | ||
| 101 | +[Desktop Entry] | ||
| 102 | +Type=Application | ||
| 103 | +Encoding=UTF-8 | ||
| 104 | +Name=i3geo | ||
| 105 | +Comment=i3geo | ||
| 106 | +Categories=Application;Geography;Geoscience;Education; | ||
| 107 | +Exec=firefox http://localhost/i3geo | ||
| 108 | +Icon=/usr/local/share/icons/i3Geo_big.png | ||
| 109 | +Terminal=false | ||
| 110 | +StartupNotify=false | ||
| 111 | +EOF | ||
| 112 | +fi | ||
| 113 | + | ||
| 114 | +# Add launcher into the Desktop folder | ||
| 115 | +USER_HOME="/home/$USER_NAME" | ||
| 116 | +USER_DESKTOP="$USER_HOME/Desktop/" | ||
| 117 | +# Add desktop icon | ||
| 118 | +if [ -d "$USER_DESKTOP" ] ; then | ||
| 119 | + echo "Copying icon to desktop at $USER_DESKTOP" | ||
| 120 | + cp /usr/local/share/applications/i3geo.desktop "$USER_DESKTOP/i3geo.desktop" | ||
| 121 | + chown $USER_NAME:$USER_NAME "$USER_DESKTOP/i3geo.desktop" | ||
| 122 | + chmod +x "$USER_DESKTOP/i3geo.desktop" | ||
| 123 | +fi | ||
| 124 | + | ||
| 125 | +#### | ||
| 126 | +#"$BUILD_DIR"/diskspace_probe.sh "`basename $0`" end |