Revision 162

View differences:

org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/generate-bundle.sh
1
#!/bin/bash
2

  
3
function usage() {
4
   echo "Generate bundle"
5
   echo ""
6
   echo "Usage:"
7
   echo "    $0"
8
}
9

  
10
SCRIPT_FILE=`readlink -f $0`
11
SCRIPT_PATH=`dirname $0`
12

  
13
WORK_FOLDER="$SCRIPT_PATH/target"
14
ACTIVITY_FOLDER_NAME="Batovi.activity"
15
ACTIVITY_FOLDER="$WORK_FOLDER/$ACTIVITY_FOLDER_NAME"
16
TARGET_FILE_NAME="org.gvsig.educa.batovi.xo"
17
TARGET_FILE="$WORK_FOLDER/$TARGET_FILE_NAME"
18

  
19

  
20
if [ ! -d "$ACTIVITY_FOLDER" ] ; then
21
  usage
22
  echo ""
23
  echo "Work folder does not exist. Missing 'prepare-bundle.sh' execution?"
24
  exit 1;
25
fi
26
if [ -f "$TARGET_FILE" ] ; then
27
  echo "Cleaning previso bundle..."
28
  rm "$TARGET_FILE"
29
fi
30

  
31
# Generate MANIFEST file
32
echo "Creating MANIFEST..."
33
cd "$ACTIVITY_FOLDER"
34
find ./ | sed "s,^./,$ACTIVITY_FOLDER_NAME/,g" > MANIFEST
35

  
36
echo "Adjusting scripts permission..."
37
# Adjust shell script permission
38
find . -name '*.sh' -exec chmod a+x {} ';'
39

  
40
# Adjust python script permission
41
find . -name '*.py' -exec chmod a+x {} ';'
42

  
43
# Generate .xo file
44
echo "Generating bundle file..."
45
cd ..
46
zip -r $TARGET_FILE_NAME $ACTIVITY_FOLDER_NAME
47

  
48
echo "Generated bundle file $TARGET_FILE"
49
echo "Done."
0 50

  
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/resources/plugins-persistence-2_0.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<xml-tag xmlns="http://www.gvsig.gva.es">
3
	<xml-tag>
4
		<property key="Skin-Selected" value="org.gvsig.educa.batovi.app.skin.BatoviSkin" />
5
		<property key="DefaultBrowser" value="Firefox" />
6
		<property key="com.iver.andami.pluginName" value="org.gvsig.coreplugin" />
7
	</xml-tag>
8
	<xml-tag>
9
		<property key="MDIFrameSize" value="1200 ,900" />
10
		<property key="MDIFramePos" value="0 ,0" />
11
		<property key="MDIFrameState" value="6" />
12
		<property key="com.iver.andami.pluginName" value="Andami.Launcher" />
13
	</xml-tag>
14
</xml-tag>
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/resources/fix_gdal_links.sh
1
#!/bin/sh
2

  
3
# Fixes symbolic link of GDAL library (if any)
4
OUT_FILE="$0.sh_out"
5

  
6
touch "$OUT_FILE"
7

  
8
echo "Check for $GVSIG_HOME/native/libgdal.so" >> "$OUT_FILE"
9
if [ -f "$GVSIG_HOME/native/libgdal.so"] ; then
10
  rm "Delete $GVSIG_HOME/native/libgdal.so" &>> "$OUT_FILE"
11
  rm "$GVSIG_HOME/native/libgdal.so" &>> "$OUT_FILE"
12
fi;
13
echo "Check for $GVSIG_HOME/native/libgdal.so.1" >> "$OUT_FILE"
14
if [ -f "$GVSIG_HOME/libgdal.so.1"] ; then
15
  rm "Delete $GVSIG_HOME/native/libgdal.so.1" &>> "$OUT_FILE"
16
  rm "$GVSIG_HOME/native/libgdal.so.1" &>> "$OUT_FILE"
17
fi;
18
echo "Check for $GVSIG_HOME/native/libgdal.so.1.*" >> "$OUT_FILE"
19
GDAL_LIB=`ls $GVSIG_HOME/native/libgdal.so.1.*`
20
echo "Found: $GDAL_LIB" >> "$OUT_FILE"
21
if [ -f "$GDAL_LIB" ] ; then
22
  echo "ln -s $GDAL_LIB $GVSIG_HOME/native/libgdal.so" >> "$OUT_FILE"
23
  ln -s "$GDAL_LIB" "$GVSIG_HOME/native/libgdal.so" &>> "$OUT_FILE"
24
  echo "ln -s $GDAL_LIB $GVSIG_HOME/native/libgdal.so.1" >> "$OUT_FILE"
25
  ln -s "$GDAL_LIB" "$GVSIG_HOME/native/libgdal.so.1" &>> "$OUT_FILE"
26
fi
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/resources/customize-gvSIG.sh
1
#!/bin/bash
2

  
3
function usage() {
4

  
5
   echo "Customize gvSIG installation"
6
   echo ""
7
   echo "Usage:"
8
   echo ""
9
   echo "    $0 -g {path-to-gvsig-tocustomize} -r {path-to-resources-folder} -w {path-to-work-folder} -a {path-to-activity-folder}"
10
   echo ""
11
   echo "Options:"
12
   echo ""
13
   echo "-g {path-to-gvsig-tocustomize}: path where gvSIG v2.0 is to customize"
14
   echo "-r {path-to-resources-folder}: path to resources folder"
15
   echo "-w {path-to-work-folder}: path to work folder"
16
   echo "-a {path-to-activity-folder}: path to work activity folder"
17
}
18

  
19

  
20
## Replace a regular expression in a file by a string
21
#
22
# Params:
23
# * File
24
# * Regular expression
25
# * Final string
26
#
27
function replaceInFile(){
28
  FILE_TO_REPLACE="$1"
29
  BACKUP_FILE="$FILE_TO_REPLACE.back"
30
  RE_FOR_SED="$2"
31
  FINAL_STRING="$3"
32

  
33
  cp "$FILE_TO_REPLACE" "$BACKUP_FILE"
34
  sed "s/$RE_FOR_SED/$FINAL_STRING/" "$BACKUP_FILE" > "$FILE_TO_REPLACE"
35
  rm "$BACKUP_FILE"
36
}
37

  
38
#set -x
39

  
40
while getopts "g:r:w:a:" OPT 
41
do	case "$OPT" in
42
	g)	export TARGET_GVSIG_FOLDER="$OPTARG";;
43
	r)	export RESOURCE_FOLDER="$OPTARG";;
44
	w)	export WORK_FOLDER="$OPTARG";;
45
	a)	export ACTIVITY_FOLDER="$OPTARG";;
46
	[?])	usage;	
47
		exit 1;;
48
	esac
49
done
50

  
51
set +e
52

  
53
if [ "x$TARGET_GVSIG_FOLDER" == "x" ] ; then
54
  usage
55
  echo ""
56
  echo "ERROR: Missing -g option"
57
  exit 1;
58
fi;
59

  
60
if [ ! -d "$TARGET_GVSIG_FOLDER" ] ; then
61
  usage
62
  echo ""
63
  echo "ERROR: $TARGET_GVSIG_FOLDER is not a gvSIG installation folder"
64
  exit 1;
65
fi;
66

  
67
if [ ! -d "$TARGET_GVSIG_FOLDER/gvSIG" ] ; then
68
  usage
69
  echo ""
70
  echo "ERROR: $TARGET_GVSIG_FOLDER is not a gvSIG installation folder"
71
  exit 1;
72
fi;
73

  
74
if [ ! -f "$TARGET_GVSIG_FOLDER/gvSIG.sh" ] ; then
75
  usage
76
  echo ""
77
  echo "ERROR: $TARGET_GVSIG_FOLDER is not a gvSIG installation folder"
78
  exit 1;
79
fi;
80

  
81
if [ ! -d "$TARGET_GVSIG_FOLDER/gvSIG/extensiones" ] ; then
82
  usage
83
  echo ""
84
  echo "ERROR: $TARGET_GVSIG_FOLDER is not a gvSIG installation folder"
85
  exit 1;
86
fi;
87

  
88
if [ "x$RESOURCE_FOLDER" == "x" ] ; then
89
  usage
90
  echo ""
91
  echo "ERROR: Missing -r option"
92
  exit 1;
93
fi;
94

  
95
if [ ! -d "$RESOURCE_FOLDER" ] ; then
96
  usage
97
  echo ""
98
  echo "ERROR: $RESOURCE_FOLDER is not a folder"
99
  exit 1;
100
fi;
101

  
102
if [ "x$WORK_FOLDER" == "x" ] ; then
103
  usage
104
  echo ""
105
  echo "ERROR: Missing -w option"
106
  exit 1;
107
fi;
108

  
109
if [ ! -d "$WORK_FOLDER" ] ; then
110
  usage
111
  echo ""
112
  echo "ERROR: $WORK_FOLDER is not a folder"
113
  exit 1;
114
fi;
115

  
116
if [ "x$ACTIVITY_FOLDER" == "x" ] ; then
117
  usage
118
  echo ""
119
  echo "ERROR: Missing -a option"
120
  exit 1;
121
fi;
122

  
123
if [ ! -d "$ACTIVITY_FOLDER" ] ; then
124
  usage
125
  echo ""
126
  echo "ERROR: $ACTIVITY_FOLDER is not a folder"
127
  exit 1;
128
fi;
129

  
130

  
131
echo "Removing unused files..."
132
rm "$TARGET_GVSIG_FOLDER/uninstall"
133
rm "$TARGET_GVSIG_FOLDER/README.txt"
134
rm "$TARGET_GVSIG_FOLDER/LEEME.txt"
135
if [ ! -n `ls "$TARGET_GVSIG_FOLDER/install/"` ] ; then
136
  rm $TARGET_GVSIG_FOLDER/install/*
137
fi
138

  
139
echo "Adding andami-config.xml..."
140
cp "$RESOURCE_FOLDER/andami-config.xml" "$ACTIVITY_FOLDER/post-install/user-gvsig-home"
141

  
142
echo "Fixing gvSIG theme files..."
143
cp "$RESOURCE_FOLDER/one_pixel.png" "$TARGET_GVSIG_FOLDER/gvSIG/extensiones/org.gvsig.app/theme/gvsig-proj-black-wallpaper.png" 
144

  
145
echo "Adjusting removing JAVA_HOME from gvSIG.sh (will be initialized at activity startup)..."
146
replaceInFile "$TARGET_GVSIG_FOLDER/gvSIG.sh" "export[ ]JAVA_HOME=.*$" "#export JAVA_HOME=INITIALIZED BY ACTIVITY"
147

  
148
echo "Adjusting JVM memory settings..."
149
if [ -n "$GVSIG_INITIAL_MEM" ] ; then
150
  echo "    GVSIG_INITIAL_MEM=$GVSIG_INITIAL_MEM"
151
  replaceInFile "$TARGET_GVSIG_FOLDER/gvSIG.sh" "GVSIG_INITIAL_MEM=[0-9]*[MG]" "GVSIG_INITIAL_MEM=$GVSIG_INITIAL_MEM"
152
fi
153
if [ -n "$GVSIG_MAX_MEM" ] ; then
154
  echo "    GVSIG_MAX_MEM=$GVSIG_MAX_MEM"
155
  replaceInFile "$TARGET_GVSIG_FOLDER/gvSIG.sh" "GVSIG_MAX_MEM=[0-9]*[MG]" "GVSIG_MAX_MEM=$GVSIG_MAX_MEM"
156
fi
157
if [ -n "$GVSIG_MAX_PERM_SIZE" ] ; then
158
  echo "    GVSIG_MAX_PERM_SIZE=$GVSIG_MAX_PERM_SIZE"
159
  replaceInFile "$TARGET_GVSIG_FOLDER/gvSIG.sh" "GVSIG_MAX_PERM_SIZE=[0-9]*[MG]" "GVSIG_MAX_PERM_SIZE=$GVSIG_MAX_PERM_SIZE"
160
fi
161

  
162
if [ -d "$TARGET_GVSIG_FOLDER/gvSIG/extensiones/org.gvsig.educa.batovi.app.skin" ] ; then
163
  echo "Adding plugin-persistence to set Skin to Batovi.app.skin..."
164
  cp "$RESOURCE_FOLDER/plugins-persistence-2_0.xml" "$ACTIVITY_FOLDER/post-install/user-gvsig-home"
165
fi
166

  
167
GDAL_FILES=`ls $TARGET_GVSIG_FOLDER/native/libgdal.so* 2> /dev/null`
168
if [ -n "$GDAL_FILES" ] ; then 
169
  echo "Removing gdal symbolic links"
170
  rm $TARGET_GVSIG_FOLDER/native/libgdal.so $TARGET_GVSIG_FOLDER/native/libgdal.so.1
171

  
172
  echo "Copying post-install script to fix gdal symbolic links"
173
  cp "$RESOURCE_FOLDER/fix_gdal_links.sh" "$ACTIVITY_FOLDER/post-install/scripts/"
174
fi
175

  
176
#echo "Resizing png images (x2)"
177
#find "$TARGET_GVSIG_FOLDER/gvSIG/extensiones" -name '*.png' -print -exec mogrify -resize 200% {} ';'
178

  
179
echo "Resizing png images..."
180
images=`find "$TARGET_GVSIG_FOLDER/gvSIG/extensiones" -name '*.png'`
181
for image in $images
182
do
183
  img_size=`file $image | grep " [0-9]* x [0-9]*" -o | grep -o "[0-9]*"`
184
  ratio=""
185
  for aSize in $img_size
186
  do
187
    if [ $aSize -le 32 ] ; then
188
      ratio="200%"
189
      break
190
    fi
191
    if [ $aSize -le 64 ] ; then
192
      ratio="150%"
193
      break
194
    fi
195
    if [ $aSize -le 128 ] ; then
196
      ratio="125%"
197
      break
198
    fi
199
  done
200
  if [ -n "$ratio" ] ; then
201
    image_caption=`echo "$image" | sed "s/.*[/]gvSIG[/]extensiones[/]//"`
202
    echo "$image_caption [ $ratio ]"
203
    mogrify -resize "$ratio" "$image"
204
  fi
205
done
206

  
207

  
208

  
0 209

  
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/resources/andami-config.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<andami-config locale-language="es" locale-country="" locale-variant="" lookAndFeel="com.sun.java.swing.plaf.gtk.GTKLookAndFeel" pluginsDirectory="gvSIG/extensiones">
3
  <andami update="true"/>
4
  <plugin name="org.gvsig.app" update="false"/>
5
</andami-config>
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/clean.sh
1
#!/bin/bash
2

  
3
SCRIPT_FILE=`readlink -f $0`
4
SCRIPT_PATH=`dirname $0`
5
WORK_FOLDER="$SCRIPT_PATH/target"
6

  
7
# clean work folder (if any)
8
if [ -e "$WORK_FOLDER" ] ; then
9
  echo "Cleaning work folder..."
10
  rm -r "$WORK_FOLDER"
11
fi
12

  
0 13

  
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/Sugerencias_de_configuracion.rst
1
===============
2
gvSIG Educa
3
===============
4

  
5
------------------------------------------------------------------------
6
Adaptación de gvSIG con fines educativos: Sugerencias de configuración
7
------------------------------------------------------------------------
8

  
9

  
10
Preparar una actividad para el OLPC
11
====================================
12

  
13
Para preparar una actividad (un fichero ``.xo``) hay que seguir los pasos del fichero *LEEME.rst*. En uno hya que prepara una instalación de gvSIG v2.0.
14

  
15
Pero, ¿Cómo debe de estar la instalación?. En este documento sugerimos los paquetes a incluir y los pasos adicionales necesarios.
16

  
17
Los pasos son:
18

  
19
# `Descargar el instalador`_ de gvSIG
20
# `Instalar los add-ons`_ a incluir
21
# `Otras configuraciones`_
22

  
23
Descargar el instalador
24
========================
25

  
26
Descargar de la página de descargas oficial la última versión de gvSIG v2.0 para linux que esté disponible, dar permisos de ejecución al fichero y arrancar la instalación.
27

  
28
Instalar los add-ons
29
=====================
30

  
31
Seguir las acciones del asistente hasta alcanzar el instalador de complementos.
32

  
33
En esta sección haremos sugerencias de paquetes dependiendo de:
34

  
35
* `Configuración Básica`_ Para equipos escasos de recurso, solo visionado de cartografía.
36
* `Configuración Estándar`_ Configuración estándar para visionado de cartografía.
37

  
38
* `Configuración con edición`_ Configuración que permita el visionado y creación de cartografía y mapas temáticos.
39

  
40
Configuración Básica
41
----------------------
42

  
43
Una configuración mínima que permita visualizar cartografía y mapas temáticos con capas vectoriales sería:
44

  
45
* Add-on manager
46
* Application gvSIG
47
* Default icon set
48
* Formats: GML/KML
49
* Formats: WFS
50
* Internationalization support
51
* Online basic help
52
* Skin management framework
53
* Thematic Maps viewer document
54
* Tools: Center view to point
55
* Tools: Hyperlink
56
* Tools: Locator by attribute
57

  
58

  
59
Esta configuración, junto al uso del *profile* ``minimum``, podría servir para equipos de unos 512Mb de RAM. Requerirá en disco sobre 40Mb (más los mapas temáticos que se incluyan).
60

  
61

  
62
Configuración Estándar
63
-----------------------
64

  
65
Una configuración estándar que permita visualizar cartografía y mapas temáticos con capas vectoriales y raster, además de algunas utilidades (como generar mapas) sería:
66

  
67
* Add-on manager
68
* Application gvSIG
69
* Default icon set
70
* Document: Layout
71
* Document: Table
72
* Formats: Gdal
73
* Formats: GML/KML
74
* Formats: WFS
75
* Internationalization support
76
* Online basic help
77
* Skin management framework
78
* Thematic Maps viewer document
79
* Tools: Center view to point
80
* Tools: Hyperlink
81
* Tools: Locator by attribute
82
* Transformation: Event theme
83
* Transformation: Join
84
* Transforms framework
85
* Web Catalog Service support
86
* Web Gazetteer Service client
87
* y el *Soporte Raster* (ver `Instalar soporte Raster`_ )
88

  
89
Esta instalación ocupará en disco unos 120Mb (más los mapas temáticos que se incluyan).
90

  
91
.. admonition:: Recordar
92

  
93
    Despues de instalar cualquier paquete es necesario reiniciar gvSIG (cerrar **y volver a arrancar**)
94

  
95

  
96
Configuración con edición
97
----------------------------------
98

  
99
Una configuración estándar que permita visualizar y preparar cartografía y mapas temáticos con capas vectoriales y raster, además de algunas utilidades (como generar mapas) sería:
100

  
101
* Add-on manager
102
* Application gvSIG
103
* Database conectors
104
* Default icon set
105
* Document: Layout
106
* Document: Table
107
* Export framework
108
* Formats: Gdal
109
* Formats: GML/KML
110
* Formats: WFS
111
* Internationalization support
112
* Online basic help
113
* Skin management framework
114
* Thematic Maps generator
115
* Thematic Maps viewer document
116
* Tools: Center view to point
117
* Tools: Export to annotation
118
* Tools: Field calculator
119
* Tools: Geometry editing
120
* Tools: Geometry measurement
121
* Tools: Hyperlink
122
* Tools: Import marker symbols tool
123
* Tools: Install marker symbols tool
124
* Tools: Locator by attribute
125
* Tools: New layer
126
* Tools: Selection tools
127
* Transformation: Event theme
128
* Transformation: Join
129
* Transforms framework
130
* Web Catalog Service support
131
* Web Gazetteer Service client
132
* y el *Soporte Raster* (ver `Instalar soporte Raster`_ )
133

  
134
Esta instalación ocupará en disco unos 140Mb (más los mapas temáticos que se incluyan).
135

  
136
.. admonition:: Recordar
137

  
138
    Despues de instalar cualquier paquete es necesario reiniciar gvSIG (cerrar **y volver a arrancar**)
139

  
140
Instalar soporte Raster
141
--------------------------
142

  
143
Ya que el linux en el que está basado el S.O. de los OLPC es un *Fedora 11*, es necesario instalar el soporte básico preparado para esta plataforma.
144

  
145
Sin en la distribución estándar no está disponible (no aparece el paquete *Raster base support* con el logo en forma de *f* de fedora), puede descargarse el fichero del componente de https://devel.gvsig.org/download/projects/gvsig-educa/pool/org.gvsig.raster.tilecache.app/ en instalarlo usando la opción de *Fichero* en el instalador.
146

  
147

  
148
Despues de instalar el soporte básico de raster instalaremos los siguientes paquetes de la instalación estándar:
149

  
150
* Formats: WCS
151
* Formats: WMS
152
* Tools: Raster tools
153

  
154
.. admonition:: Recordar
155

  
156
    Despues de instalar cualquier paquete es necesario reiniciar gvSIG (cerrar **y volver a arrancar**)
157

  
158

  
159
Otras configuraciones
160
========================
161

  
162
En esta sección describimos otros pasos a realizar para afinar la instalación de gvSIG 2.0.
163

  
164
Skin Batovi
165
-------------
166

  
167
En el directorio *org.gvsig.batovi.app* (hermano del actual) está el plugin de gvSIG que contiene un Skin personalizado.
168

  
169
Para instalar, tener generado el paquete del add-on (fichero ``.gvspkg``), arrancar el gvSIG que estamos preparando e installar usando el *Administrador de Add-on*.
170

  
171
Deshabilitar extensiones
172
-------------------------
173

  
174
Es recomendable desactivar algunas extensiones que vienen activas por defecto. 
175

  
176
Para ello, una vez instalada la aplicación acceder al panel de configuración del menú ``Ver/Preferencias`` y, dentro de la rama ``General/extensiones`` buscar las siguientes y _desmarcar_ la opción ``Extensión activa``.
177

  
178
* org.gvsig.app.extension.ShowDevelInfoExtension
179
* org.gvsig.installer.app.extension.creation.MakePluginPackageExtension
180
* org.gvsig.app.extension.dispose.DisposableManagementExtension
181

  
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/LEEME.rst
1
===============
2
gvSIG Educa
3
===============
4

  
5
-------------------------------------------------
6
Adaptación de gvSIG con fines educativos
7
-------------------------------------------------
8

  
9
Descripción
10
==============
11

  
12
Este fichero contiene información para generar un paquete de instalación de gvSIG personalizado que puede instalarse en el sistema operativo *Sugar* de los OLPC.
13

  
14
Contenido del directorio
15
===========================
16

  
17
* *profiles* : Directorio con configuraciones de entorno de ejecución para usar en la creación de la actividad
18

  
19
* *resource*: Recursos que son utilizados en la generación de la activida
20

  
21
* *skeleton*: Esqueleto de la activida, incluye los fichero de información, estructura de directorio y scrits de ejecución de la actividad.
22

  
23
* *README.rst* *LEEME.rst*: Este fichero
24

  
25
* *Sugerencias_de_configuracion.rst*: Documento con sugerencias para preparar gvSIG 2.0 para empaquetar
26

  
27
Requisitos
28
==============
29

  
30
* *Sistema operativo Linux*: Por ser *Sugar* un sistema operativo basado en Linux-base (*Fedora 9*)
31

  
32
Generar el paquete de instalación
33
=====================================
34

  
35
Esta sección explica como generar un paquete de *activida* (fichero ``.xo``).
36

  
37
Instalar gvSIG 2.0
38
---------------------
39

  
40
Es necesario instalar gvSIG v2.0 en el sistema para poder usarla como base de plugins y configuraciones que deseamos tener en la distribución para el OLPC.
41

  
42
Para más información sobre que paquetes/complementos instalar en gvSIG ver el fichero *Sugerencias_de_configuracion.rst*.
43

  
44
Limpiar compilación previa
45
----------------------------
46

  
47
Para limpiar una ejecución previa solo es necesario borrar el directorio de trabajo *target* o ejecutar el script *clean.sh* ::
48

  
49
   bash$ ./clean.sh
50

  
51

  
52
Preparar el paquete
53
---------------------
54

  
55
En este paso prepararemos el directorio temporal para general el paquete. Para ello ejecutar el script *prepare-bundle.sh*. Este script soporta los siguiente parámetros:
56

  
57
* ``-g {path}``:  *[obligatorio]* Directorio donde está la instalación de gvSIG 2.0 a usar como base.
58
* ``-p {profile}``:  *[opcional, standard por defecto]* Profile a usar para configura el entorno de ejecucion de gvSIG en el OLPC.
59
* ``-v {pkgVersion}``: *[obligatorio][entero]* Versión para el paquete generado.
60
* ``-t``: *[optional]* Incluir los mapas temáticos instalados en el directorio del usuario.
61

  
62
Un ejemplo de ejecución::
63

  
64
   bash$ ./prepare-bundle.sh -g "/tmp/gvSIG-2.0" -v 3
65

  
66
Este script, dentro de su proceso, ejecuta el script *resources/customize-gvSIG.sh* que ajusta gvSIG para el funcionamiento en el OLPC.
67

  
68
El script genera un directorio *target* que contiene el contenido que se usará para generar el *bundle*. Puede realizar, después de la ejecución del script, cualquier modificación que necesite hacer a mano.
69

  
70
El parámetro ``-t`` incluye todos los *mapas temáticos* que estén instalados en el directorio local de gvSIG (localizados en el directorio *~/gvSIG/plugins/org.gvsig.educa.thematicmap.app.viewer*).
71

  
72
Generar el paquete
73
--------------------
74

  
75
En este paso se genera el fichero ``.xo``` de la actividad. Únicamente es necesario ejecutar el script *generate-bundle.sh* ::
76

  
77
   bash$ ./generate-bundle.sh
78

  
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/prepare-bundle.sh
1
#!/bin/bash
2

  
3
function usage() {
4
   echo "Prepare work folder to generate bundle"
5
   echo ""
6
   echo "Usage:"
7
   echo ""
8
   echo "    $0 -g {path-to-gvsig-installation} -v {bundle-version} [-p {profile}] [-t]"
9
   echo ""
10
   echo "Options:"
11
   echo ""
12
   echo "-g {path-to-gvsig-installation}: path where gvSIG v2.0 is installed"
13
   echo "-v {bundle-version}: path where gvSIG v2.0 is installed"
14
   echo "-p {profile}: profile to use (default 'standard')"
15
   echo "-t Include Thematic Maps from ~/gvSIG/plugins/org.gvsig.educa.thematicmap.app.viewer"
16
   echo ""
17
   echo "Availables profiles:"
18
   echo ""
19
   curpath=$PWD
20
   cd "$SCRIPT_PATH/profiles"
21
   for profile in *.profile
22
   do
23
      profile_name=`echo "$profile" | sed "s/[.]profile//"`
24
      profile_desc=`cat $profile_name.description`
25
      echo "  $profile_name :  $profile_desc"
26
   done
27
   cd "$curpath"
28

  
29
}
30

  
31
#set -x
32

  
33
SCRIPT_FILE=`readlink -f $0`
34
SCRIPT_PATH=`dirname $0`
35
PROFILE_TO_USE=standard
36

  
37
while getopts "g:v:p:t" OPT 
38
do	case "$OPT" in
39
	g)	SOURCE_GVSIG_FOLDER="$OPTARG";;
40
	v)	XO_PKG_VERSION="$OPTARG";;
41
	p)	PROFILE_TO_USE="$OPTARG";;
42
	t)	INCLUDE_THEMATIC_MAPS="true";;
43
	[?])	usage;	
44
		exit 1;;
45
	esac
46
done
47

  
48
set +e
49

  
50
if [ "x$SOURCE_GVSIG_FOLDER" == "x" ] ; then
51
  usage
52
  echo ""
53
  echo "ERROR: Missing -g option"
54
  exit 1;
55
fi;
56

  
57
if [ "x$SOURCE_GVSIG_FOLDER" == "x" ] ; then
58
  usage
59
  echo ""
60
  echo "ERROR: Missing -g option"
61
  exit 1;
62
fi;
63

  
64
if [ ! -d "$SOURCE_GVSIG_FOLDER" ] ; then
65
  usage
66
  echo ""
67
  echo "ERROR: $SOURCE_GVSIG_FOLDER is not a gvSIG installation folder"
68
  exit 1;
69
fi;
70

  
71
if [ ! -d "$SOURCE_GVSIG_FOLDER/gvSIG" ] ; then
72
  usage
73
  echo ""
74
  echo "ERROR: $SOURCE_GVSIG_FOLDER is not a gvSIG installation folder"
75
  exit 1;
76
fi;
77

  
78
if [ ! -f "$SOURCE_GVSIG_FOLDER/gvSIG.sh" ] ; then
79
  usage
80
  echo ""
81
  echo "ERROR: $SOURCE_GVSIG_FOLDER is not a gvSIG installation folder"
82
  exit 1;
83
fi;
84

  
85
if [ ! -d "$SOURCE_GVSIG_FOLDER/gvSIG/extensiones" ] ; then
86
  usage
87
  echo ""
88
  echo "ERROR: $SOURCE_GVSIG_FOLDER is not a gvSIG installation folder"
89
  exit 1;
90
fi;
91

  
92
if [ "x$XO_PKG_VERSION" == "x" ] ; then
93
  usage
94
  echo ""
95
  echo "ERROR: Missing -v option"
96
  exit 1;
97
fi;
98

  
99
expr "$XO_PKG_VERSION" + 1 2> /dev/null > /dev/null
100
if [ ! $? = 0 ] ; then
101
  usage
102
  echo ""
103
  echo "ERROR: Invalid value for -v"
104
  exit 1;
105
fi
106

  
107
if [ "$XO_PKG_VERSION" -le 0 ] ; then
108
  usage
109
  echo ""
110
  echo "ERROR: Invalid value for -v"
111
  exit 1;
112
fi;
113

  
114
if [ ! -f "$SCRIPT_PATH/profiles/$PROFILE_TO_USE.profile" ] ; then
115
  usage
116
  echo ""
117
  echo "ERROR: Ivalid profile $PROFILE_TO_USE"
118
  exit 1;
119
fi;
120

  
121
echo "Playing profile ($PROFILE_TO_USE)..."
122
set -e
123
source "$SCRIPT_PATH/profiles/$PROFILE_TO_USE.profile"
124
set -e
125

  
126
WORK_FOLDER="$SCRIPT_PATH/target"
127

  
128
# clean work folder (if any)
129
if [ -e "$WORK_FOLDER" ] ; then
130
  echo "Cleaning work folder..."
131
  rm -r "$WORK_FOLDER"
132
fi
133

  
134
# create work folder
135
echo "Creating work folder..."
136
mkdir "$WORK_FOLDER"
137

  
138
# copy base activity files
139
ACTIVITY_FOLDER="$WORK_FOLDER/Batovi.activity"
140
echo "Copying base activity files..."
141
tar c --exclude-vcs --exclude-backups skeleton  | tar x -C "$WORK_FOLDER"
142
mv "$WORK_FOLDER/skeleton" "$ACTIVITY_FOLDER"
143

  
144

  
145
# set bundle version
146
echo "Updating bundle version ($XO_PKG_VERSION)...."
147
cp "$ACTIVITY_FOLDER/activity/activity.info" "$WORK_FOLDER/tmp.info"
148
sed "s/[$][{]version[}]/$XO_PKG_VERSION/" "$WORK_FOLDER"/tmp.info > "$ACTIVITY_FOLDER/activity/activity.info"
149
rm "$WORK_FOLDER"/tmp.info
150
info=`cat "$ACTIVITY_FOLDER/activity/activity.info"`
151
if [ -e "$info" ] ; then
152
   echo "ERROR: in info file: Empty"
153
fi
154

  
155
# copy gvSIG files
156
echo "Copying gvSIG app files (from $SOURCE_GVSIG_FOLDER)..."
157

  
158
TARGET_GVSIG_FOLDER="$ACTIVITY_FOLDER/gvSIG"
159
GVSIG_FILES=`ls $SOURCE_GVSIG_FOLDER`
160
tar c --exclude-vcs --exclude-backups -C $SOURCE_GVSIG_FOLDER  $GVSIG_FILES | tar x -C $TARGET_GVSIG_FOLDER
161

  
162
# clean install folder
163
echo "Clean gvSIG install folder..."
164
rm -rf $TARGET_GVSIG_FOLDER/install/*
165

  
166
# clean install folder
167
echo "Clean gvSIG plugins install folder..."
168
to_remove=`find $TARGET_GVSIG_FOLDER/gvSIG/extensiones -name "install" -type d`
169
for file_to_remove in $to_remove
170
  do
171
    echo "    $file_to_remove"
172
    rm -r "$file_to_remove"
173
  done
174

  
175
# Call customizer script
176
echo "Calling customized gvSIG Installation script ($SCRIPT_PATH/resources/customize-gvSIG.sh)..."
177
echo ""
178
set -e
179
"$SCRIPT_PATH/resources/customize-gvSIG.sh" -g "$TARGET_GVSIG_FOLDER" -r "$SCRIPT_PATH/resources" -w "$WORK_FOLDER" -a "$ACTIVITY_FOLDER"
180
echo ""
181
set +e
182
echo "customized script Done. Resuming..."
183

  
184

  
185

  
186
# include thematic maps
187
if [ "$INCLUDE_THEMATIC_MAPS" == "true" ] ; then {
188
  echo "Check for installed Thematic Maps..."
189

  
190
  # Check if there is any thematic map
191
  GVSIG_PLUGINS_FOLDER="$HOME/gvSIG/plugins"
192
  THEMATIC_MAPS_PLUGIN_FOLDER="$GVSIG_PLUGINS_FOLDER/org.gvsig.educa.thematicmap.app.viewer"
193
  THEMATIC_MAPS_INSTALL_FOLDER="$THEMATIC_MAPS_PLUGIN_FOLDER/thematicMaps"
194
  if [ -d "$THEMATIC_MAPS_INSTALL_FOLDER" ] ; then {
195
    THEMATIC_MAP_LIST=`ls $THEMATIC_MAPS_INSTALL_FOLDER`
196
    if [ ! -e "$THEMATIC_MAP_LIST" ] ; then {
197
      TARGET_THEMATICMAP_FOLDER="$ACTIVITY_FOLDER/post-install/user-gvsig-home/plugins/org.gvsig.educa.thematicmap.app.viewer"
198

  
199
      # create folder for plugins in post-install folder
200
      mkdir -p "$TARGET_THEMATICMAP_FOLDER"
201

  
202
      echo "Copying Thematic Maps..."
203
      # copy thematic maps
204
      tar c --exclude-vcs --exclude-backups -C "$THEMATIC_MAPS_PLUGIN_FOLDER" thematicMaps | tar x -C  "$TARGET_THEMATICMAP_FOLDER"
205
      echo "Thematic Maps included:"
206
      echo ""
207
      ls "$TARGET_THEMATICMAP_FOLDER/thematicMaps"
208
      echo ""
209
    }
210
    else {
211
      # No found Thematic Maps installed
212
      echo "No Thematic Maps installed (none installed)..."
213
    }
214
    fi
215
  } 
216
  else {
217
    # No found Thematic Maps install folder
218
    echo "No Thematic Maps installed (install folder $THEMATIC_MAPS_INSTALL_FOLDER not found)..."
219
  }
220
  fi
221
}
222
fi
223
echo "Done."
224

  
0 225

  
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/profiles/standard.profile
1
#!/bin/sh
2
export GVSIG_INITIAL_MEM="90M"
3
export GVSIG_MAX_MEM="280M"
4
export GVSIG_MAX_PERM_SIZE="80M"
0 5

  
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/profiles/standard.description
1
Stardart configuration for a system with RAM >= 512Mb
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/profiles/minimum.profile
1
#!/bin/sh
2
export GVSIG_INITIAL_MEM="30M"
3
export GVSIG_MAX_MEM="75M"
4
export GVSIG_MAX_PERM_SIZE="60M"
0 5

  
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/profiles/minimum.description
1
Configuration for a system with RAM < 512Mb
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/README.rst
1
===============
2
gvSIG Educa
3
===============
4

  
5
-------------------------------------------------
6
Customization of gvSIG for education purpose
7
-------------------------------------------------
8

  
9
Description
10
==============
11

  
12
This file contensts information to generate a custom gvSIG instalation package for OLPC Operation Sistem *Sugar*
13

  
14
Requirements
15
==============
16

  
17
* *Linux S.O.*: As *Sugar* is a Linux-base Operation System.
18

  
19
Generate distribution package
20
==============================
21

  
22
This section explains how to generate the package (the ``.xo`` file).
23

  
24
Install gvSIG 2.0
25
-------------------
26

  
27
We need to install a gvSIG v2.0 in our system. On it, we install all plug-ins which we want to incluide in the OLPC distribution.
28

  
29
See *Sugerencias_de_configuracion.rst* for information about packages to install.
30

  
31
Clean previous compilations
32
----------------------------
33

  
34
Before start clean the work folder of previous generating process (if any). Just remove ``target`` folder or execute the ``clean.sh`` script::
35

  
36
   bash$ ./clean.sh
37

  
38

  
39
Prepare bundle
40
----------------
41

  
42
In this step we going to prepare a temporal folder where the package contents will be copied. To do it execute ``prepare-bundle.sh`` script which allows this parameters:
43

  
44
* ``-g {path}``:  *[mandatory]* Specifies where is the gvSIG 2.0 instalation to use as base
45
* ``-p {profile}``:  *[optiona default standard]* Specifies which profile must use to configure OLPC execution environ.
46
* ``-v {pkgVersion}``: *[mandatory][integer]* Version for the target *Activity* package.
47
* ``-t``: *[optional]* Include installed Thematic Maps
48

  
49
An example of this command could be::
50

  
51
   bash$ ./prepare-bundle.sh -g "/tmp/gvSIG-2.0" -v 3
52

  
53
This script also executes *resources/customize-gvSIG.sh* which adjust gvSIG configurations.
54

  
55
This command generates a ``target`` folder with contents of bundle. You can make any change on it at this point in order of include extra content.
56

  
57
The ``-t`` includes all Thematic Map installed in gvSIG user folder (located in *~/gvSIG/plugins/org.gvsig.educa.thematicmap.app.viewer* folder).
58

  
59
Generate bundle
60
-----------------
61

  
62
In this step the final ``.xo`` activity bundle is generate. Just execute the script ``generate-bundle.sh``::
63

  
64
   bash$ ./generate-bundle.sh
65

  
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/skeleton/GvSIGActivity.py
1
import os, shutil, stat
2
import gtk, gobject
3
import popen2
4
from os import path as Path
5

  
6
import logging
7
import sugar.activity.activity as activity
8
from sugar.activity.activity import Activity
9
from sugar.datastore import datastore
10

  
11
"""
12
Alternative paths to locate JRE
13
"""
14
JAVA_HOME_PATHS=(
15
#"/usr/lib/jvm/jre", # gcj path DOESN'T WORK!!!
16
str(Path.join(Path.expanduser("~"),"Activities/Java.activity/jre")), # Java activity path
17
    )
18

  
19
# LOG level config
20
logging.basicConfig(level=logging.DEBUG)
21
#logging.basicConfig(level=logging.INFO)
22

  
23

  
24
"""
25
gvSIG batovi activity
26

  
27
Requires:
28

  
29
* Sugar builds > 706
30

  
31
* A java installed or the Java activity installed
32

  
33
  For more information see: http://www.mediagala.com/rap/foro/viewtopic.php?f=8&t=166
34

  
35
On first _run_ executes son post-install actions.
36

  
37
"""
38
class GvSIGActivity(Activity):
39
    # gvSIG Home path (where is gvSIG activity)
40
    gvsig_activity=None
41

  
42
    # gvSIG Home path (where is gvSIG installation)
43
    gvsig_home=None
44

  
45

  
46
    #Java Home
47
    java_home=None
48

  
49

  
50
    def __init__(self, handle):
51
      logging.debug('Creating GvSIG handler.')
52
      
53
      Activity.__init__(self, handle)
54
      self.handle = handle
55

  
56
      # Register run() to run from gtk_main_loop
57
      # as soon as it gets idle.
58
      # Which is kludge to make it run after the loop has begun
59
      self.idleFunc = gobject.idle_add(self.run)
60

  
61
    def run(self):
62
      # Remove run() because we want it to run only once
63
      gobject.source_remove(self.idleFunc)
64

  
65
      # locate and check jre
66
      if not self.initializeJavaHome():
67
        # Exiting with a error  
68
        self.showMessageError("Can't found any JRE to run gvSIG:\nSee http://www.mediagala.com/rap/foro/viewtopic.php?f=8&t=166\nfor more information")
69
        logging.error("No JRE found!!!")
70
        logging.debug("Closing activity");
71
        self.close(True)
72
        return
73

  
74
      # setup environ properties
75
      self.gvsig_activity=activity.get_bundle_path()
76
      self.gvsig_home=Path.join(self.gvsig_activity, 'gvSIG')
77

  
78
      os.environ['GVSIG_HOME']=self.gvsig_home
79
      os.environ['GVSIG_ACTIVITY']=self.gvsig_activity
80
      os.environ['JAVA_HOME']=self.java_home
81

  
82
      # do post-install actions
83
      self.postInstall()
84

  
85
      # identify gvSIG launcher
86
      gvSIG_sh = Path.join(activity.get_bundle_path(), 'gvSIG', 'gvSIG.sh')
87

  
88
      if not Path.exists(gvSIG_sh):
89
        raise Exception("Missing gvSIG launcher: %s" % gvSIG_sh)
90

  
91
      # check execution permission
92
      self.fixExcecutionFilePermission(gvSIG_sh)
93
      
94
      try:
95
        logging.info("Executing '%s'" % gvSIG_sh);
96

  
97
        # execute gvSIG.sh
98
        gvSIG_process = popen2.Popen4('%s' % gvSIG_sh, 16)
99

  
100
        # writing stout in log file
101
        logging.info(gvSIG_process.fromchild.read())
102

  
103
        # wait until gvSIG exit
104
        rcode = gvSIG_process.wait()
105

  
106
        logging.info('gvSIG.sh returned with code=%d' % rcode)
107

  
108
      finally:
109
        logging.debug("Closing activity");
110
        self.close(True)
111

  
112
    def showMessageError(self, message):
113
        md = gtk.MessageDialog(self, 
114
              gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, 
115
              gtk.BUTTONS_CLOSE, message)
116
        md.run()
117
        md.destroy()
118

  
119
    """
120
    Initialize property ``java_home``
121

  
122
    Try to locate a valid java in ``JAVA_HOME_PATHS`` list
123

  
124
    Check that existe a *bin/java* executable file inside of it.
125

  
126
    If not JRE found returns False. Otherwise returns True
127
    """
128
    def initializeJavaHome(self):
129
      for jhome in JAVA_HOME_PATHS:
130
        logging.debug("check jre in %s" % jhome)
131
        if not Path.exists(jhome):
132
          logging.debug("%s not found" % jhome)
133
          continue
134
        if self.checkJavaExecutable(jhome):
135
          self.java_home=jhome
136
          logging.debug("ussing '%s' for JAVA_HOME" % jhome)
137
          return True
138
      else:
139
        logging.debug("No Java available in register paths: %s" % repr(JAVA_HOME_PATHS))
140
        return False
141

  
142

  
143

  
144

  
145
    """
146
    Check ``javaHome`` folder: check that exist a *bin/java* executable file
147

  
148
    Returns True/False
149
    """
150
    def checkJavaExecutable(self, javaHome):
151
      javaExe=Path.join(javaHome,"bin","java")
152
      if not Path.exists(javaExe):
153
        return False
154
      return os.access(javaExe, os.X_OK)
155

  
156
    """
157
    Run post install actions.
158

  
159
    This actions usually will be execute just once, in first activity run
160
    """
161
    def postInstall(self):
162
      self.installInGvSIGUserHome()
163
      self.installInUserHome()
164
      self.execScripts()
165

  
166
    """
167
    *Post Intall process:* Excecutes install scripts
168

  
169
    This actions usually will be execute just once, in first activity run.
170
    """
171
    def execScripts(self):
172
      # check if ther is any file to copy to 
173
      sourceFolder = Path.join(activity.get_bundle_path(), 'post-install', 'scripts')
174

  
175
      if not Path.exists(sourceFolder):
176
        # No files to execute
177
        return
178

  
179
      everyScriptOk = True
180

  
181
      # for all file/dir in souceFolder
182
      scriptFiles = os.listdir(sourceFolder)
183

  
184
      for aFile in scriptFiles:
185
        fext = Path.splitext(aFile)[1]
186
        aFilePath = Path.join(sourceFolder,aFile)
187
        if fext == ".py":
188
          # Exec python script
189
          execOk = self.execPython(aFilePath)
190
          if execOk:
191
            shutil.move(aFilePath,aFilePath+".done")
192
          else:
193
             everyScriptOk=False
194

  
195

  
196
        elif fext == ".sh":
197
          # Exec Shell script
198
          execOk = self.execShell(aFilePath)
199
          if execOk:
200
            shutil.move(aFilePath,aFilePath+".done")
201
          else:
202
             everyScriptOk=False
203

  
204
        elif fext == "done":
205
          # Nothing to do
206
          pass
207

  
208
        else:
209
          # Ignoring file
210
          logging.debug("Ignoring post-install script: " + aFilePath)
211

  
212

  
213
      if everyScriptOk:
214
        # rename folder to avoid execution on next application open
215
        shutil.move(sourceFolder, sourceFolder+".done")
216

  
217
    """
218
    Excecutes a python script file
219
    """
220
    def execPython(self,aFile):
221
      logging.debug("Executing python script '%s'" % aFile);
222
      try:
223
        # open file in read-only mode
224
        f = file(aFile,"r")
225

  
226
        # exec script
227
        try:
228
          exec f
229
        finally:
230
          f.close()
231

  
232
        return True
233
      except Exception, exc:
234
        logging.error("Excecuting file %s: %s" % (aFile,exc));
235
        return False
236
      
237
    """
238
    Fix (set) execution permission of a file
239
    """
240
    def fixExcecutionFilePermission(self, aFile):
241
      # check execution permission
242
      if not os.access(aFile, os.X_OK):
243
        # set excecution permission
244
        os.chmod(aFile,os.stat(aFile)+stat.S_IEXEC)
245

  
246
    """
247
    Excecutes a shell script file
248
    """
249
    def execShell(self,aFile):
250
      logging.debug("Executing '%s'" % aFile);
251
      try:
252
        mProcess = popen2.Popen4('%s' % aFile, 16)
253
        logging.debug(mProcess.fromchild.read())
254
        rcode = mProcess.wait()
255
        return rcode == 0
256
      except Exception, exc:
257
        logging.error("Excecuting file %s: %s" % (aFile,exc));
258
        return False
259

  
260

  
261
    """
262
    *Post Intall process:* Install files in user home
263

  
264
    Move files from ``{activity_folder}/post-install/user-home`` to ``$HOME``
265

  
266
    **NOTE**: if a file/dir already exist **will be ignored** (Keeping untouched original files)
267
    """
268
    def installInUserHome(self):
269
      # check if ther is any file to copy to 
270
      sourceFolder = Path.join(activity.get_bundle_path(), 'post-install', 'user-home')
271

  
272
      if not Path.exists(sourceFolder):
273
        # No files to copy
274
        return
275

  
276
      homeUserFolder = Path.expanduser("~")
277

  
278
      #merge folder
279
      self.mergeFolder(sourceFolder,homeUserFolder)
280

  
281
      #rename source folder to prevent rerun of this step
282
      os.rename(sourceFolder,sourceFolder+".done")
283

  
284
      #done
285
      return
286

  
287
    """
288
    *Post Intall process:* Install files in the gvSIG user home folder
289

  
290
    Move files from ``{activity_folder}/post-install/user-gvsig-home`` to ``$HOME/gvSIG``
291
    """
292
    def installInGvSIGUserHome(self):
293
      # check if ther is any file to copy to 
294
      sourceFolder = Path.join(activity.get_bundle_path(), 'post-install', 'user-gvsig-home')
295

  
296
      if not Path.exists(sourceFolder):
297
        # No files to copy
298
        return
299

  
300
      homeGvsigUserFolder = Path.expanduser("~/gvSIG")
301

  
302
      if not Path.exists(homeGvsigUserFolder):
303
        # Create gvSIG user home folder
304
        os.mkdir(homeGvsigUserFolder)
305

  
306

  
307
      #move files
308
      self.mergeFolder(sourceFolder,homeGvsigUserFolder)
309

  
310
      #rename source folder to prevent rerun of this step
311
      os.rename(sourceFolder,sourceFolder+".done")
312

  
313
      #done
314
      return
315

  
316
    """
317
    Move files from ``sourceFolder`` into ``targetFolder``
318

  
319
    ``sourceFolder`` must be a folder
320
    ``targetFolder`` must be a folder or not exists (so it will be created)
321
    ``overrideTarget`` if it's ``False`` raise an exception when target already contains the file/dir to move. if ``ignoreExisting``
322
    ``ignoreExisting`` modifies ``overrideTarget`` option (when it's ``False``) to don't raise an exception, just skip file/folder
323
    """
324
    def moveFiles(self,sourceFolder,targetFolder,overrideTarget=True,ignoreExisting=True):
325
      if not Path.exists(targetFolder):
326
        # Create target folder
327
        os.makedirs(targetFolder)
328
        # set overrideTarget to True because target is new
329
        overrideTarget=True
330
      elif not Path.isdir(targetFolder):
331
        raise Exception("%s must be a dir" % targetFolder)
332

  
333
      # for all file/dir in souceFolder
334
      toMoveList = os.listdir(sourceFolder)
335
      for toMove in toMoveList:
336

  
337
        target = Path.join(targetFolder,toMove)
338
        # check if exists target
339
        if Path.exists(target):
340
          if overrideTarget:
341
            if ignoreExisting:
342
              continue
343
            
344
          else:
345
            if ignoreExisting:
346
              continue
347
            else:
348
              raise Exception("%s alredy exists in target folder %s" % (toMove, targetFolder))
349

  
350

  
351
        # move file/dir
352
        shutil.move(Path.join(sourceFolder, toMove), targetFolder)
353

  
354
   
355
    """
356
    Merge folder content: Copy all missing folders and files from
357
    ``sourceFolder`` to ``targetFolder``.
358

  
359
    Process doesn't override existing files in ``targetFolder``
360
    """
361
    def mergeFolder(self,sourceFolder,targetFolder):
362
      # get folder contents
363
      names = os.listdir(sourceFolder)
364

  
365
      if not Path.exists(targetFolder):
366
        # Create target folder if not exists
367
        os.makedirs(targetFolder)
368

  
369
      for name in names:
370
        srcname = Path.join(sourceFolder, name)
371
        dstname = Path.join(targetFolder, name)
372
        if Path.isdir(srcname):
373
          # Recursive call to mergeFolder
374
          self.mergeFolder(srcname,dstname)
375
        else:
376
          if not Path.exists(dstname):
377
            # Copy new file
378
            shutil.copy(srcname,dstname)
379
          else:
380
            # skip existing file
381
            continue
382

  
383

  
384

  
385

  
386

  
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/skeleton/post-install/README.rst
1
===========================================
2
gvSIG batovi Activity Post-intall process
3
===========================================
4

  
5

  
6
This folder contains all supported *post-intall* actions implemented in gvSIG activity.
7

  
8

  
9
user-gvsig-home
10
================
11

  
12
Files of this folder will be **merged** (copy only files than no exists on target folder) with *~/gvSIG* folder of user intallation in first gvSIG activity execution.
13

  
14

  
15
After that this folder will be renamed to *user-gvsig-home.done*.
16

  
17

  
18
user-home
19
===========
20

  
21
Files of this folder will be **merged** (copy only files than no exists on target folder)  to *user home* folder.
22

  
23
After that this folder will be removed.
24

  
25
scripts
26
========
27

  
28
Excecutes contained scripts in first gvSIG activity execution. Only *Pyhon* (files ``.py``) and *Shell* (files ``.sh``) are allowed (other files will be ignored).
29

  
30
Before all execution this environ variables will be set:
31

  
32
* ``GVSIG_ACTIVITY``: root folder of gvSIG activity (usually ``~/Activities/org.gvsig.batovi.activity``)
33

  
34
* ``GVSIG_HOME``: root folder of gvSIG installation (usually ``$GVSIG_ACTIVITY/gvSIG``)
35

  
36
After the script excution will be renamed (adds ``.done``) to prevent future executions.
37

  
38
When all script were executed, this folder will be renamed (adds ``.done``).
39

  
40
See log file for problems in script executions.
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/skeleton/activity/activity.info
1
[Activity]
2
name = gvSIG Batovi
3
bundle_id = Batovi.Activity
4
class = GvSIGActivity.GvSIGActivity
5
icon = activity-gvsig
6
activity_version = ${version}
7
host_version = 1
8
show_launcher = yes
9

  
org.gvsig.educa.batovi/tags/1.0.0-beta1/org.gvsig.educa.batovi/org.gvsig.educa.batovi.activity/skeleton/activity/activity-gvsig.svg
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<!-- Created with Inkscape (http://www.inkscape.org/) -->
3

  
4
<svg
5
   xmlns:dc="http://purl.org/dc/elements/1.1/"
6
   xmlns:cc="http://creativecommons.org/ns#"
7
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
   xmlns:svg="http://www.w3.org/2000/svg"
9
   xmlns="http://www.w3.org/2000/svg"
10
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12
   width="55"
13
   height="55"
14
   id="svg4502"
15
   sodipodi:version="0.32"
16
   inkscape:version="0.48.2 r9819"
17
   version="1.0"
18
   sodipodi:docname="logo_gvsig.svg"
19
   inkscape:output_extension="org.inkscape.output.svg.inkscape">
20
  <defs
21
     id="defs4504" />
22
  <sodipodi:namedview
23
     id="base"
24
     pagecolor="#ffffff"
25
     bordercolor="#666666"
26
     borderopacity="1.0"
27
     gridtolerance="10000"
28
     guidetolerance="10"
29
     objecttolerance="10"
30
     inkscape:pageopacity="0.0"
31
     inkscape:pageshadow="2"
32
     inkscape:zoom="1"
33
     inkscape:cx="32.531924"
34
     inkscape:cy="23.680342"
35
     inkscape:document-units="px"
36
     inkscape:current-layer="layer3"
37
     width="55px"
38
     height="55px"
39
     inkscape:window-width="1440"
40
     inkscape:window-height="876"
41
     inkscape:window-x="0"
42
     inkscape:window-y="24"
43
     showgrid="false"
44
     inkscape:window-maximized="1">
45
    <inkscape:grid
46
       id="GridFromPre046Settings"
47
       type="xygrid"
48
       originx="0px"
49
       originy="0px"
50
       spacingx="15px"
51
       spacingy="15px"
52
       color="#0000ff"
53
       empcolor="#0000ff"
54
       opacity="0.2"
55
       empopacity="0.4"
56
       empspacing="5" />
57
  </sodipodi:namedview>
58
  <metadata
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff