root / tags / v1_0_2_Build_898 / install / distribucion.sh @ 10513
History | View | Annotate | Download (10.4 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.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 |
echo OK. |
114 |
|
115 |
# Estas extensiones se copian directamente al directorio destino, ya que no vamos a dar |
116 |
# opcion a no instalarlas, son obligatorias |
117 |
cd "$DIR_BASE" |
118 |
i=0 |
119 |
while [ ! -z ${MANDATORY_EXTENSIONS[$i]} ] |
120 |
do |
121 |
echo ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_LIN"/bin/gvSIG/extensiones |
122 |
ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_LIN"/bin/gvSIG/extensiones |
123 |
echo ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_WIN"/bin/gvSIG/extensiones |
124 |
ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_WIN"/bin/gvSIG/extensiones |
125 |
i=`expr $i + 1` |
126 |
done |
127 |
|
128 |
echo "*****************" |
129 |
[ $LOC = "es" ] && echo " EXTENSIONES " |
130 |
[ $LOC != "es" ] && echo " EXTENSIONS " |
131 |
echo "*****************" |
132 |
|
133 |
rm -rf $DIR_LIN/extensiones |
134 |
mkdir $DIR_LIN/extensiones |
135 |
rm -rf $DIR_WIN/extensiones |
136 |
mkdir $DIR_WIN/extensiones |
137 |
|
138 |
i=0 |
139 |
while [ ! -z ${EXTENSIONS[$i]} ] |
140 |
do |
141 |
[ $LOC = "es" ] && echo "Copiando "${EXTENSIONS[$i]} |
142 |
[ $LOC != "es" ] && echo "Copying "${EXTENSIONS[$i]} |
143 |
echo cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_LIN"/extensiones -rf |
144 |
cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_LIN"/extensiones -rf |
145 |
echo cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_WIN"/extensiones -rf |
146 |
cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_WIN"/extensiones -rf |
147 |
i=`expr $i + 1` |
148 |
done |
149 |
|
150 |
## Eliminamos el driver de oracle |
151 |
find -L . -name ojdbc14.jar -type f -exec rm -rf {} 2> /dev/null ';' || true |
152 |
find -L . -name gt2-oracle-spatial-2.2.1.jar -type f -exec rm -rf {} 2> /dev/null ';' || true |
153 |
find -L . -name sdoapi.jar -type f -exec rm -rf {} 2> /dev/null ';' || true |
154 |
|
155 |
|
156 |
echo "*****************" |
157 |
echo " INST-WIN " |
158 |
echo "*****************" |
159 |
# Generar el instalador (jar) para windows |
160 |
cd "$DIR_BASE"/"$DIR_WIN" |
161 |
rm "$JARNAME" -f |
162 |
ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME" |
163 |
|
164 |
echo "*****************" |
165 |
echo " INST-LIN " |
166 |
echo "*****************" |
167 |
# Generar el instalador (jar) para Linux |
168 |
cd "$DIR_BASE"/"$DIR_LIN" |
169 |
rm "$JARNAME" -f |
170 |
ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME" |
171 |
|
172 |
|
173 |
echo "******************" |
174 |
[ $LOC = "es" ] && echo " GENERAR DISTRIB " |
175 |
[ $LOC != "es" ] && echo " GENERATE DISTRIB " |
176 |
echo "******************" |
177 |
# Generar el tar.gz para Linux y el EXE para Windows |
178 |
|
179 |
mkdir -p "$OUTPUT_DIR" |
180 |
echo "- Linux" |
181 |
## Para Linux |
182 |
cd "$DIR_BASE"/"$DIR_LIN" |
183 |
rm -Rf "$INSTALLER_DIR" |
184 |
cp -a installer_files "$INSTALLER_DIR" |
185 |
rm -R "$INSTALLER_DIR"/CVS 2> /dev/null && true |
186 |
# Set the correct version number in the scripts and files |
187 |
if [ -f "$INSTALLER_DIR"/install.sh ] ; then |
188 |
sed "s/JARNAME/$JARNAME/" "$INSTALLER_DIR"/install.sh > "$INSTALLER_DIR"/install.sh.bak |
189 |
mv "$INSTALLER_DIR"/install.sh.bak "$INSTALLER_DIR"/install.sh ; |
190 |
chmod +x "$INSTALLER_DIR"/install.sh |
191 |
fi |
192 |
#mv "$JARNAME" "$INSTALLER_DIR" |
193 |
cp "$JARNAME" "$INSTALLER_DIR" |
194 |
tar -cvzf "$LINUXZIP" "$INSTALLER_DIR" |
195 |
rm -Rf "$INSTALLER_DIR" |
196 |
mv "$LINUXZIP" "$OUTPUT_DIR" |
197 |
|
198 |
## Nueva instalacion para linux |
199 |
cd "$DIR_BASE"/"$DIR_LIN" |
200 |
rm -Rf "$INSTALLER_DIR" |
201 |
mkdir -p "$INSTALLER_DIR"/tmp_gvSIGInstall |
202 |
cp "$JARNAME" "$INSTALLER_DIR"/tmp_gvSIGInstall |
203 |
cd "$INSTALLER_DIR" |
204 |
cp -R "$DIR_BASE"/launcher/izpack-launcher-1.3_linux/dist/* ./tmp_gvSIGInstall |
205 |
find . -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true |
206 |
|
207 |
sed "s/%JARNAME%/$JARNAME/" ./tmp_gvSIGInstall/launcher.ini > ./tmp_gvSIGInstall/launcher.ini.bak |
208 |
mv ./tmp_gvSIGInstall/launcher.ini.bak ./tmp_gvSIGInstall/launcher.ini; |
209 |
|
210 |
tar -cvzf ./tmp.tgz ./tmp_gvSIGInstall |
211 |
cp "$DIR_BASE"/"$DIR_LIN"/jre/*.gz ./tmp_gvSIGInstall |
212 |
tar -cvzf ./tmp_wjre.tgz ./tmp_gvSIGInstall |
213 |
echo '#!/bin/sh' > xx.tmp |
214 |
lcount=`cat xx.tmp "$DIR_BASE"/launcher/izpack-launcher-1.3_linux/h_gvSIG-install.sh | wc -l` |
215 |
lcount=$(($lcount+2)) # sumamos dos: uno por la linea siguiente y otro para el inicio |
216 |
echo "lcount=$lcount" >> xx.tmp |
217 |
cat xx.tmp "$DIR_BASE"/launcher/izpack-launcher-1.3_linux/h_gvSIG-install.sh ./tmp.tgz > "$LINUXBIN" |
218 |
cat xx.tmp "$DIR_BASE"/launcher/izpack-launcher-1.3_linux/h_gvSIG-install.sh ./tmp_wjre.tgz > "$LINUXBINWITHJRE" |
219 |
rm xx.tmp |
220 |
chmod a+x "$LINUXBIN" "$LINUXBINWITHJRE" |
221 |
mv "$LINUXBINWITHJRE" "$LINUXBIN" "$OUTPUT_DIR" |
222 |
cd "$DIR_BASE"/"$DIR_LIN" |
223 |
rm -Rf "$INSTALLER_DIR" |
224 |
## Fin Nueva instalacion para linux |
225 |
rm "$JARNAME" |
226 |
|
227 |
|
228 |
|
229 |
|
230 |
## Para Windows |
231 |
echo "- Windows" |
232 |
#set -x |
233 |
cd "$DIR_BASE"/"$DIR_WIN" |
234 |
rm -Rf "$INSTALLER_DIR" |
235 |
cp -a installer_files "$INSTALLER_DIR" |
236 |
|
237 |
cp -aR ../launcher/izpack-launcher-1.3/dist/* "$INSTALLER_DIR" |
238 |
rm -f "$INSTALLER_DIR"/install.bat |
239 |
|
240 |
find "$INSTALLER_DIR" -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true |
241 |
|
242 |
## hacemos las sustituciones de la variable |
243 |
sed "s/%JARNAME%/$JARNAME/" "$INSTALLER_DIR"/launcher-Win32.ini > "$INSTALLER_DIR"/launcher-Win32.ini.bak |
244 |
mv "$INSTALLER_DIR"/launcher-Win32.ini.bak "$INSTALLER_DIR"/launcher-Win32.ini; |
245 |
|
246 |
|
247 |
mv "$JARNAME" "$INSTALLER_DIR" |
248 |
cd "$INSTALLER_DIR" |
249 |
|
250 |
if [ -f "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" ] ; then |
251 |
rm -f "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" |
252 |
fi |
253 |
"$DIR_BASE"/launcher/7z/7za a -r "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" * |
254 |
cd - |
255 |
sed "s/%TITLE%/$APPNAME-$BRIEFVERSION\_$BUILDNUMBER/" ../launcher/7z/dist_config.txt > dist_config.txt |
256 |
cat ../launcher/7z/7zS.sfx dist_config.txt "$WINDOWSZIP" > "$WINDOWSEXE" |
257 |
|
258 |
### paquete con los instalables de JRE, Jai y Jai i/o |
259 |
"$DIR_BASE"/launcher/7z/7za a "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" "$DIR_BASE"/"$DIR_WIN"/jre_installers/*.exe |
260 |
cat ../launcher/7z/7zS.sfx dist_config.txt "$WINDOWSZIP" > "$WINDOWSEXEWITHJRE" |
261 |
|
262 |
### |
263 |
|
264 |
|
265 |
rm dist_config.txt |
266 |
rm "$WINDOWSZIP" |
267 |
|
268 |
rm -Rf "$INSTALLER_DIR" |
269 |
|
270 |
mv "$WINDOWSEXE" "$OUTPUT_DIR" |
271 |
mv "$WINDOWSEXEWITHJRE" "$OUTPUT_DIR" |
272 |
|
273 |
# Limpiamos tmpResources |
274 |
cd "$DIR_BASE"/"$DIR_WIN" |
275 |
rm -r ./tmpResources |
276 |
cd - |
277 |
|
278 |
|
279 |
## Para Mac |
280 |
echo "- Mac" |
281 |
if type ant 2>/dev/null >/dev/null; then |
282 |
cd "$DIR_BASE"/"$DIR_MAC" |
283 |
if ant -Dbuild.number="$BUILDNUMBER" -f build.xml; then |
284 |
zip -r "$MAC_10_ZIP" gvSIG*.app |
285 |
rm -r gvSIG*.app |
286 |
mv "$MAC_10_ZIP" "$OUTPUT_DIR" |
287 |
else |
288 |
echo "No se ha generado el paquete para Mac 10 . Compruebe que su ant tiene jarbundler instalado |
289 |
|
290 |
Nota: debemos tener incluido en el ANT_HOME/lib el |
291 |
jar jarbundler-1.9.jar que se puede encontrar en http://jarbundler.sourceforge.net/ |
292 |
" |
293 |
|
294 |
fi |
295 |
|
296 |
else |
297 |
echo "No se ha encontrado el ant en el path de ejecucion: |
298 |
Es necesario para poder generar la distribucion para el Mac. |
299 |
|
300 |
Nota: debemos tener tambien incluido en el ANT_HOME/lib el |
301 |
jar jarbundler-1.9.jar que se puede encontrar en http://jarbundler.sourceforge.net/ |
302 |
" |
303 |
fi |
304 |
|
305 |
|
306 |
## Limpiamos |
307 |
|
308 |
rm -rf $DIR_LIN/extensiones |
309 |
rm -rf $DIR_LIN/bin |
310 |
rm -rf $DIR_WIN/extensiones |
311 |
rm -rf $DIR_WIN/bin |
312 |
|
313 |
echo "*****************" |
314 |
echo " FIN " |
315 |
echo "*****************" |
316 |
|
317 |
echo "" |
318 |
echo "Generados los ficheros:" |
319 |
echo "$OUTPUT_DIR" |
320 |
ls -lh "$OUTPUT_DIR" |
321 |
cd "$DIR_BASE" |