svn-gvsig-desktop / tags / v2_0_Build_1213 / install / distribucion.sh @ 38511
History | View | Annotate | Download (10.5 KB)
1 |
#!/bin/bash |
---|---|
2 |
|
3 |
# Si se produce un error, salimos inmediatamente |
4 |
set -e |
5 |
|
6 |
# Obtenemos el locale |
7 |
LOC=`echo $LANG | sed 's/_.*//'` |
8 |
|
9 |
# Comprobar que estamos en el directorio adecuado |
10 |
if [ "$LOC" = "es" ] ; then |
11 |
ERROR_BASEDIR="Este script debe invocarse desde el directorio raiz del workspace o desde el directorio \'install\'" |
12 |
else |
13 |
ERROR_BASEDIR="This script must be run from the workspace\'s root directory or from the \'install\' directory" |
14 |
fi |
15 |
[ -d _fwAndami ] && [ -d install ] && cd install |
16 |
if [ ! -d instalador-gvSIG-lin ] || [ ! -d instalador-gvSIG-win ] || [ ! -d ../_fwAndami ] ; then |
17 |
echo $ERROR_BASEDIR |
18 |
exit 1 ; |
19 |
fi |
20 |
|
21 |
DIR_BASE=`pwd` |
22 |
|
23 |
source variables.sh |
24 |
# Get a version with format 1_0_alpha |
25 |
UNDERSCORE_VERSION=`echo $FULLVERSION | sed 'y/./_/'` |
26 |
# Get a version with format 10_alpha |
27 |
BRIEFVERSION=`echo $FULLVERSION | sed 's/\.//'` |
28 |
# The name of the dir which will be ZIPed, containing the resulting installer |
29 |
INSTALLER_DIR="$APPNAME"-$FULLVERSION\_installer |
30 |
JARNAME="$APPNAME"-"$FULLVERSION".jar |
31 |
# The extension targets on the this version of gvSIG: |
32 |
GVSIG_VERSION=1.0 |
33 |
|
34 |
BUILDNUMBER=`sed -n 's/build.number=//p' ../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/build.number` |
35 |
|
36 |
#ZIPNAME="$APPNAME"-"$UNDERSCORE_VERSION"\_"$BUILDNUMBER".zip |
37 |
DIR_LIN=instalador-gvSIG-lin |
38 |
DIR_WIN=instalador-gvSIG-win |
39 |
DIR_MAC=instalador-gvSIG-mac |
40 |
WINDOWSZIP="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-windows-i586.7z |
41 |
LINUXZIP="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-linux-i586.tgz |
42 |
|
43 |
LINUXBIN="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-linux-i586.bin |
44 |
LINUXBINWITHJRE="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-linux-i586-withjre.bin |
45 |
|
46 |
WINDOWSEXE="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-windows-i586.exe |
47 |
WINDOWSEXEWITHJRE="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-windows-i586-withjre.exe |
48 |
|
49 |
MAC_10_ZIP="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-mac-10_3.zip |
50 |
|
51 |
#Directorios |
52 |
#OUTPUT_DIR=/mnt/sercartlin/grupo-sig-ca/Testing/Versiones/v"$FULLVERSION"\_"$BUILDNUMBER" |
53 |
OUTPUT_DIR="$TARGET_DIR"/v"$FULLVERSION"\_"$BUILDNUMBER" |
54 |
PATH_SOURCE_EXT=../_fwAndami/gvSIG/extensiones |
55 |
PATH_SOURCE_MANDAT_EXT=../../../../../_fwAndami/gvSIG/extensiones |
56 |
|
57 |
|
58 |
echo "*****************" |
59 |
echo " BASE " |
60 |
echo "*****************" |
61 |
# Para Linux |
62 |
echo -n "$DIR_BASE"/"$DIR_LIN" "-- " |
63 |
cd "$DIR_BASE"/"$DIR_LIN" |
64 |
rm bin -rf |
65 |
mkdir -p bin/gvSIG/extensiones |
66 |
cp installer_files/LEEME installer_files/LLIG-ME installer_files/README bin |
67 |
cp resources/gpl.txt bin |
68 |
# No enlazamos directamente el directorio lib para no incluir el directorio CVS |
69 |
mkdir -p bin/lib |
70 |
cd "$DIR_BASE"/"$DIR_LIN"/bin/lib |
71 |
for i in ../../../../_fwAndami/lib/*.jar ; do |
72 |
ln -s "$i" . |
73 |
done |
74 |
for i in ../../../../_fwAndami/lib/*.zip ; do |
75 |
ln -s "$i" . |
76 |
done |
77 |
cd "$DIR_BASE"/"$DIR_LIN" |
78 |
ln -s ../../../_fwAndami/andami.jar bin/ |
79 |
ln -s ../../../_fwAndami/castor.properties bin/ |
80 |
#cp resources/andami-config.xml bin |
81 |
echo OK. |
82 |
|
83 |
|
84 |
# Para Windows |
85 |
echo -n "$DIR_BASE"/"$DIR_WIN" "-- " |
86 |
cd "$DIR_BASE"/"$DIR_WIN" |
87 |
rm bin -rf |
88 |
mkdir -p bin/gvSIG/extensiones |
89 |
cp installer_files/LEEME.txt installer_files/LLIG-ME.txt installer_files/README.txt bin |
90 |
cp resources/gpl.txt bin |
91 |
# No enlazamos directamente el directorio lib para no incluir el directorio CVS |
92 |
mkdir -p bin/lib |
93 |
cd "$DIR_BASE"/"$DIR_WIN"/bin/lib |
94 |
for i in ../../../../_fwAndami/lib/*.jar ; do |
95 |
ln -s "$i" . |
96 |
done |
97 |
for i in ../../../../_fwAndami/lib/*.zip ; do |
98 |
ln -s "$i" . |
99 |
done |
100 |
cd "$DIR_BASE"/"$DIR_WIN" |
101 |
ln -s ../../../_fwAndami/andami.jar bin |
102 |
ln -s ../../../_fwAndami/castor.properties bin/ |
103 |
#cp resources/andami-config.xml bin |
104 |
|
105 |
#Copiamos el lanzador y sus tracuciones al tmpResources |
106 |
rm -Rf tmpResources |
107 |
mkdir tmpResources |
108 |
cp -R ../launcher/izpack-launcher-1.3/dist/* ./tmpResources |
109 |
mv ./tmpResources/launcher-Win32.exe ./tmpResources/gvSIG.exe |
110 |
#Quitamos el ini, manifest y los CVS |
111 |
rm ./tmpResources/*.ini ./tmpResources/*.manifest |
112 |
find ./tmpResources -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true |
113 |
cp ./resources/gvSIG.ini ./tmpResources/gvSIG.ini |
114 |
echo OK. |
115 |
|
116 |
# Estas extensiones se copian directamente al directorio destino, ya que no vamos a dar |
117 |
# opcion a no instalarlas, son obligatorias |
118 |
cd "$DIR_BASE" |
119 |
i=0 |
120 |
while [ ! -z ${MANDATORY_EXTENSIONS[$i]} ] |
121 |
do |
122 |
echo ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_LIN"/bin/gvSIG/extensiones |
123 |
ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_LIN"/bin/gvSIG/extensiones |
124 |
echo ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_WIN"/bin/gvSIG/extensiones |
125 |
ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_WIN"/bin/gvSIG/extensiones |
126 |
i=`expr $i + 1` |
127 |
done |
128 |
|
129 |
## Eliminamos el driver de oracle |
130 |
find . -name ojdbc14.jar -type f -exec rm -rf {} 2> /dev/null ';' || true |
131 |
find . -name gt2-oracle-spatial-2.2.1.jar -type f -exec rm -rf {} 2> /dev/null ';' || true |
132 |
find . -name sdoapi.jar -type f -exec rm -rf {} 2> /dev/null ';' || true |
133 |
|
134 |
echo "*****************" |
135 |
[ $LOC = "es" ] && echo " EXTENSIONES " |
136 |
[ $LOC != "es" ] && echo " EXTENSIONS " |
137 |
echo "*****************" |
138 |
|
139 |
rm -rf $DIR_LIN/extensiones |
140 |
mkdir $DIR_LIN/extensiones |
141 |
rm -rf $DIR_WIN/extensiones |
142 |
mkdir $DIR_WIN/extensiones |
143 |
|
144 |
i=0 |
145 |
while [ ! -z ${EXTENSIONS[$i]} ] |
146 |
do |
147 |
[ $LOC = "es" ] && echo "Copiando "${EXTENSIONS[$i]} |
148 |
[ $LOC != "es" ] && echo "Copying "${EXTENSIONS[$i]} |
149 |
echo cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_LIN"/extensiones -rf |
150 |
cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_LIN"/extensiones -rf |
151 |
echo cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_WIN"/extensiones -rf |
152 |
cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_WIN"/extensiones -rf |
153 |
i=`expr $i + 1` |
154 |
done |
155 |
|
156 |
|
157 |
echo "*****************" |
158 |
echo " INST-WIN " |
159 |
echo "*****************" |
160 |
# Generar el instalador (jar) para windows |
161 |
cd "$DIR_BASE"/"$DIR_WIN" |
162 |
rm "$JARNAME" -f |
163 |
ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME" |
164 |
|
165 |
echo "*****************" |
166 |
echo " INST-LIN " |
167 |
echo "*****************" |
168 |
# Generar el instalador (jar) para Linux |
169 |
cd "$DIR_BASE"/"$DIR_LIN" |
170 |
rm "$JARNAME" -f |
171 |
ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME" |
172 |
|
173 |
|
174 |
echo "******************" |
175 |
[ $LOC = "es" ] && echo " GENERAR DISTRIB " |
176 |
[ $LOC != "es" ] && echo " GENERATE DISTRIB " |
177 |
echo "******************" |
178 |
# Generar el tar.gz para Linux y el EXE para Windows |
179 |
|
180 |
mkdir -p "$OUTPUT_DIR" |
181 |
echo "- Linux" |
182 |
## Para Linux |
183 |
cd "$DIR_BASE"/"$DIR_LIN" |
184 |
rm -Rf "$INSTALLER_DIR" |
185 |
cp -a installer_files "$INSTALLER_DIR" |
186 |
rm -R "$INSTALLER_DIR"/CVS 2> /dev/null && true |
187 |
# Set the correct version number in the scripts and files |
188 |
if [ -f "$INSTALLER_DIR"/install.sh ] ; then |
189 |
sed "s/JARNAME/$JARNAME/" "$INSTALLER_DIR"/install.sh > "$INSTALLER_DIR"/install.sh.bak |
190 |
mv "$INSTALLER_DIR"/install.sh.bak "$INSTALLER_DIR"/install.sh ; |
191 |
chmod +x "$INSTALLER_DIR"/install.sh |
192 |
fi |
193 |
#mv "$JARNAME" "$INSTALLER_DIR" |
194 |
cp "$JARNAME" "$INSTALLER_DIR" |
195 |
tar -cvzf "$LINUXZIP" "$INSTALLER_DIR" |
196 |
rm -Rf "$INSTALLER_DIR" |
197 |
mv "$LINUXZIP" "$OUTPUT_DIR" |
198 |
|
199 |
## Nueva instalacion para linux |
200 |
cd "$DIR_BASE"/"$DIR_LIN" |
201 |
rm -Rf "$INSTALLER_DIR" |
202 |
mkdir -p "$INSTALLER_DIR"/tmp_gvSIGInstall |
203 |
cp "$JARNAME" "$INSTALLER_DIR"/tmp_gvSIGInstall |
204 |
cd "$INSTALLER_DIR" |
205 |
cp -R "$DIR_BASE"/launcher/izpack-launcher-1.3_linux/dist/* ./tmp_gvSIGInstall |
206 |
find . -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true |
207 |
|
208 |
sed "s/%JARNAME%/$JARNAME/" ./tmp_gvSIGInstall/launcher.ini > ./tmp_gvSIGInstall/launcher.ini.bak |
209 |
mv ./tmp_gvSIGInstall/launcher.ini.bak ./tmp_gvSIGInstall/launcher.ini; |
210 |
|
211 |
tar -cvzf ./tmp.tgz ./tmp_gvSIGInstall |
212 |
cp "$DIR_BASE"/"$DIR_LIN"/jre/*-1_4_2_*.gz ./tmp_gvSIGInstall |
213 |
tar -cvzf ./tmp_wjre.tgz ./tmp_gvSIGInstall |
214 |
echo '#!/bin/sh' > xx.tmp |
215 |
lcount=`cat xx.tmp "$DIR_BASE"/launcher/izpack-launcher-1.3_linux/h_gvSIG-install.sh | wc -l` |
216 |
lcount=$(($lcount+2)) # sumamos dos: uno por la linea siguiente y otro para el inicio |
217 |
echo "lcount=$lcount" >> xx.tmp |
218 |
cat xx.tmp "$DIR_BASE"/launcher/izpack-launcher-1.3_linux/h_gvSIG-install.sh ./tmp.tgz > "$LINUXBIN" |
219 |
cat xx.tmp "$DIR_BASE"/launcher/izpack-launcher-1.3_linux/h_gvSIG-install.sh ./tmp_wjre.tgz > "$LINUXBINWITHJRE" |
220 |
rm xx.tmp |
221 |
chmod a+x "$LINUXBIN" "$LINUXBINWITHJRE" |
222 |
mv "$LINUXBINWITHJRE" "$LINUXBIN" "$OUTPUT_DIR" |
223 |
cd "$DIR_BASE"/"$DIR_LIN" |
224 |
rm -Rf "$INSTALLER_DIR" |
225 |
## Fin Nueva instalacion para linux |
226 |
rm "$JARNAME" |
227 |
|
228 |
|
229 |
|
230 |
|
231 |
## Para Windows |
232 |
echo "- Windows" |
233 |
#set -x |
234 |
cd "$DIR_BASE"/"$DIR_WIN" |
235 |
rm -Rf "$INSTALLER_DIR" |
236 |
cp -a installer_files "$INSTALLER_DIR" |
237 |
|
238 |
cp -aR ../launcher/izpack-launcher-1.3/dist/* "$INSTALLER_DIR" |
239 |
rm -f "$INSTALLER_DIR"/install.bat |
240 |
|
241 |
find "$INSTALLER_DIR" -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true |
242 |
|
243 |
## hacemos las sustituciones de la variable |
244 |
sed "s/%JARNAME%/$JARNAME/" "$INSTALLER_DIR"/launcher-Win32.ini > "$INSTALLER_DIR"/launcher-Win32.ini.bak |
245 |
mv "$INSTALLER_DIR"/launcher-Win32.ini.bak "$INSTALLER_DIR"/launcher-Win32.ini; |
246 |
|
247 |
|
248 |
mv "$JARNAME" "$INSTALLER_DIR" |
249 |
cd "$INSTALLER_DIR" |
250 |
|
251 |
if [ -f "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" ] ; then |
252 |
rm -f "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" |
253 |
fi |
254 |
"$DIR_BASE"/launcher/7z/7za a -r "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" * |
255 |
cd - |
256 |
sed "s/%TITLE%/$APPNAME-$BRIEFVERSION\_$BUILDNUMBER/" ../launcher/7z/dist_config.txt > dist_config.txt |
257 |
cat ../launcher/7z/7zS.sfx dist_config.txt "$WINDOWSZIP" > "$WINDOWSEXE" |
258 |
|
259 |
### paquete con los instalables de JRE, Jai y Jai i/o |
260 |
"$DIR_BASE"/launcher/7z/7za a "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" "$DIR_BASE"/"$DIR_WIN"/jre_installers/*.exe |
261 |
cat ../launcher/7z/7zS.sfx dist_config.txt "$WINDOWSZIP" > "$WINDOWSEXEWITHJRE" |
262 |
|
263 |
### |
264 |
|
265 |
|
266 |
rm dist_config.txt |
267 |
rm "$WINDOWSZIP" |
268 |
|
269 |
rm -Rf "$INSTALLER_DIR" |
270 |
|
271 |
mv "$WINDOWSEXE" "$OUTPUT_DIR" |
272 |
mv "$WINDOWSEXEWITHJRE" "$OUTPUT_DIR" |
273 |
|
274 |
# Limpiamos tmpResources |
275 |
cd "$DIR_BASE"/"$DIR_WIN" |
276 |
rm -r ./tmpResources |
277 |
cd - |
278 |
|
279 |
|
280 |
## Para Mac |
281 |
echo "- Mac" |
282 |
if type ant 2>/dev/null >/dev/null; then |
283 |
cd "$DIR_BASE"/"$DIR_MAC" |
284 |
if ant -Dbuild.number="$BUILDNUMBER" -Djvmversion="1.4+" -f build.xml; then |
285 |
zip -r "$MAC_10_ZIP" gvSIG*.app |
286 |
rm -r gvSIG*.app |
287 |
mv "$MAC_10_ZIP" "$OUTPUT_DIR" |
288 |
else |
289 |
echo "No se ha generado el paquete para Mac 10 . Compruebe que su ant tiene jarbundler instalado |
290 |
|
291 |
Nota: debemos tener incluido en el ANT_HOME/lib el |
292 |
jar jarbundler-1.9.jar que se puede encontrar en http://jarbundler.sourceforge.net/ |
293 |
" |
294 |
|
295 |
fi |
296 |
|
297 |
else |
298 |
echo "No se ha encontrado el ant en el path de ejecucion: |
299 |
Es necesario para poder generar la distribucion para el Mac. |
300 |
|
301 |
Nota: debemos tener tambien incluido en el ANT_HOME/lib el |
302 |
jar jarbundler-1.9.jar que se puede encontrar en http://jarbundler.sourceforge.net/ |
303 |
" |
304 |
fi |
305 |
|
306 |
|
307 |
## Limpiamos |
308 |
|
309 |
rm -rf $DIR_LIN/extensiones |
310 |
rm -rf $DIR_LIN/bin |
311 |
rm -rf $DIR_WIN/extensiones |
312 |
rm -rf $DIR_WIN/bin |
313 |
|
314 |
echo "*****************" |
315 |
echo " FIN " |
316 |
echo "*****************" |
317 |
|
318 |
echo "" |
319 |
echo "Generados los ficheros:" |
320 |
echo "$OUTPUT_DIR" |
321 |
ls -lh "$OUTPUT_DIR" |
322 |
cd "$DIR_BASE" |