svn-gvsig-desktop / trunk / install / distribucion.sh @ 8656
History | View | Annotate | Download (10.1 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_3_ZIP="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-mac-10_3.zip |
50 |
MAC_10_4_ZIP="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-mac-10_4.zip |
51 |
|
52 |
#Directorios |
53 |
#OUTPUT_DIR=/mnt/sercartlin/grupo-sig-ca/Testing/Versiones/v"$FULLVERSION"\_"$BUILDNUMBER" |
54 |
OUTPUT_DIR="$TARGET_DIR"/v"$FULLVERSION"\_"$BUILDNUMBER" |
55 |
PATH_SOURCE_EXT=../_fwAndami/gvSIG/extensiones |
56 |
PATH_SOURCE_MANDAT_EXT=../../../../../_fwAndami/gvSIG/extensiones |
57 |
|
58 |
|
59 |
echo "*****************" |
60 |
echo " BASE " |
61 |
echo "*****************" |
62 |
# Para Linux |
63 |
echo -n "$DIR_BASE"/"$DIR_LIN" "-- " |
64 |
cd "$DIR_BASE"/"$DIR_LIN" |
65 |
rm bin -rf |
66 |
mkdir -p bin/gvSIG/extensiones |
67 |
cp installer_files/LEEME installer_files/LLIG-ME installer_files/README bin |
68 |
cp resources/gpl.txt bin |
69 |
# No enlazamos directamente el directorio lib para no incluir el directorio CVS |
70 |
mkdir -p bin/lib |
71 |
cd "$DIR_BASE"/"$DIR_LIN"/bin/lib |
72 |
for i in ../../../../_fwAndami/lib/*.jar ; do |
73 |
ln -s "$i" . |
74 |
done |
75 |
for i in ../../../../_fwAndami/lib/*.zip ; do |
76 |
ln -s "$i" . |
77 |
done |
78 |
cd "$DIR_BASE"/"$DIR_LIN" |
79 |
ln -s ../../../_fwAndami/andami.jar bin/ |
80 |
ln -s ../../../_fwAndami/castor.properties bin/ |
81 |
#cp resources/andami-config.xml bin |
82 |
echo OK. |
83 |
|
84 |
|
85 |
# Para Windows |
86 |
echo -n "$DIR_BASE"/"$DIR_WIN" "-- " |
87 |
cd "$DIR_BASE"/"$DIR_WIN" |
88 |
rm bin -rf |
89 |
mkdir -p bin/gvSIG/extensiones |
90 |
cp installer_files/LEEME.txt installer_files/LLIG-ME.txt installer_files/README.txt bin |
91 |
cp resources/gpl.txt bin |
92 |
# No enlazamos directamente el directorio lib para no incluir el directorio CVS |
93 |
mkdir -p bin/lib |
94 |
cd "$DIR_BASE"/"$DIR_WIN"/bin/lib |
95 |
for i in ../../../../_fwAndami/lib/*.jar ; do |
96 |
ln -s "$i" . |
97 |
done |
98 |
for i in ../../../../_fwAndami/lib/*.zip ; do |
99 |
ln -s "$i" . |
100 |
done |
101 |
cd "$DIR_BASE"/"$DIR_WIN" |
102 |
ln -s ../../../_fwAndami/andami.jar bin |
103 |
ln -s ../../../_fwAndami/castor.properties bin/ |
104 |
#cp resources/andami-config.xml bin |
105 |
|
106 |
#Copiamos el lanzador y sus tracuciones al tmpResources |
107 |
rm -Rf tmpResources |
108 |
mkdir tmpResources |
109 |
cp -R ../launcher/izpack-launcher-1.3/dist/* ./tmpResources |
110 |
mv ./tmpResources/launcher-Win32.exe ./tmpResources/gvSIG.exe |
111 |
#Quitamos el ini, manifest y los CVS |
112 |
rm ./tmpResources/*.ini ./tmpResources/*.manifest |
113 |
find ./tmpResources -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true |
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 |
|
130 |
echo "*****************" |
131 |
[ $LOC = "es" ] && echo " EXTENSIONES " |
132 |
[ $LOC != "es" ] && echo " EXTENSIONS " |
133 |
echo "*****************" |
134 |
|
135 |
rm -rf $DIR_LIN/extensiones |
136 |
mkdir $DIR_LIN/extensiones |
137 |
rm -rf $DIR_WIN/extensiones |
138 |
mkdir $DIR_WIN/extensiones |
139 |
|
140 |
i=0 |
141 |
while [ ! -z ${EXTENSIONS[$i]} ] |
142 |
do |
143 |
[ $LOC = "es" ] && echo "Copiando "${EXTENSIONS[$i]} |
144 |
[ $LOC != "es" ] && echo "Copying "${EXTENSIONS[$i]} |
145 |
echo cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_LIN"/extensiones -rf |
146 |
cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_LIN"/extensiones -rf |
147 |
echo cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_WIN"/extensiones -rf |
148 |
cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_WIN"/extensiones -rf |
149 |
i=`expr $i + 1` |
150 |
done |
151 |
|
152 |
|
153 |
echo "*****************" |
154 |
echo " INST-WIN " |
155 |
echo "*****************" |
156 |
# Generar el instalador (jar) para windows |
157 |
cd "$DIR_BASE"/"$DIR_WIN" |
158 |
rm "$JARNAME" -f |
159 |
ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME" |
160 |
|
161 |
echo "*****************" |
162 |
echo " INST-LIN " |
163 |
echo "*****************" |
164 |
# Generar el instalador (jar) para Linux |
165 |
cd "$DIR_BASE"/"$DIR_LIN" |
166 |
rm "$JARNAME" -f |
167 |
ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME" |
168 |
|
169 |
|
170 |
echo "******************" |
171 |
[ $LOC = "es" ] && echo " GENERAR DISTRIB " |
172 |
[ $LOC != "es" ] && echo " GENERATE DISTRIB " |
173 |
echo "******************" |
174 |
# Generar el tar.gz para Linux y el EXE para Windows |
175 |
|
176 |
mkdir -p "$OUTPUT_DIR" |
177 |
echo "- Linux" |
178 |
## Para Linux |
179 |
cd "$DIR_BASE"/"$DIR_LIN" |
180 |
rm -Rf "$INSTALLER_DIR" |
181 |
cp -a installer_files "$INSTALLER_DIR" |
182 |
rm -R "$INSTALLER_DIR"/CVS 2> /dev/null && true |
183 |
# Set the correct version number in the scripts and files |
184 |
if [ -f "$INSTALLER_DIR"/install.sh ] ; then |
185 |
sed "s/JARNAME/$JARNAME/" "$INSTALLER_DIR"/install.sh > "$INSTALLER_DIR"/install.sh.bak |
186 |
mv "$INSTALLER_DIR"/install.sh.bak "$INSTALLER_DIR"/install.sh ; |
187 |
chmod +x "$INSTALLER_DIR"/install.sh |
188 |
fi |
189 |
#mv "$JARNAME" "$INSTALLER_DIR" |
190 |
cp "$JARNAME" "$INSTALLER_DIR" |
191 |
tar -cvzf "$LINUXZIP" "$INSTALLER_DIR" |
192 |
rm -Rf "$INSTALLER_DIR" |
193 |
mv "$LINUXZIP" "$OUTPUT_DIR" |
194 |
|
195 |
## Nueva instalacion para linux |
196 |
cd "$DIR_BASE"/"$DIR_LIN" |
197 |
rm -Rf "$INSTALLER_DIR" |
198 |
mkdir -p "$INSTALLER_DIR"/tmp_gvSIGInstall |
199 |
cp "$JARNAME" "$INSTALLER_DIR"/tmp_gvSIGInstall |
200 |
cd "$INSTALLER_DIR" |
201 |
cp -R "$DIR_BASE"/launcher/izpack-launcher-1.3_linux/dist/* ./tmp_gvSIGInstall |
202 |
find . -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true |
203 |
|
204 |
sed "s/%JARNAME%/$JARNAME/" ./tmp_gvSIGInstall/launcher.ini > ./tmp_gvSIGInstall/launcher.ini.bak |
205 |
mv ./tmp_gvSIGInstall/launcher.ini.bak ./tmp_gvSIGInstall/launcher.ini; |
206 |
|
207 |
tar -cvzf ./tmp.tgz ./tmp_gvSIGInstall |
208 |
cp "$DIR_BASE"/"$DIR_LIN"/jre/*.gz ./tmp_gvSIGInstall |
209 |
tar -cvzf ./tmp_wjre.tgz ./tmp_gvSIGInstall |
210 |
echo '#!/bin/sh' > xx.tmp |
211 |
lcount=`cat xx.tmp "$DIR_BASE"/launcher/izpack-launcher-1.3_linux/h_gvSIG-install.sh | wc -l` |
212 |
lcount=$(($lcount+2)) # sumamos dos: uno por la linea siguiente y otro para el inicio |
213 |
echo "lcount=$lcount" >> xx.tmp |
214 |
cat xx.tmp "$DIR_BASE"/launcher/izpack-launcher-1.3_linux/h_gvSIG-install.sh ./tmp.tgz > "$LINUXBIN" |
215 |
cat xx.tmp "$DIR_BASE"/launcher/izpack-launcher-1.3_linux/h_gvSIG-install.sh ./tmp_wjre.tgz > "$LINUXBINWITHJRE" |
216 |
rm xx.tmp |
217 |
chmod a+x "$LINUXBIN" "$LINUXBINWITHJRE" |
218 |
mv "$LINUXBINWITHJRE" "$LINUXBIN" "$OUTPUT_DIR" |
219 |
cd "$DIR_BASE"/"$DIR_LIN" |
220 |
rm -Rf "$INSTALLER_DIR" |
221 |
## Fin Nueva instalacion para linux |
222 |
rm "$JARNAME" |
223 |
|
224 |
|
225 |
|
226 |
|
227 |
## Para Windows |
228 |
echo "- Windows" |
229 |
#set -x |
230 |
cd "$DIR_BASE"/"$DIR_WIN" |
231 |
rm -Rf "$INSTALLER_DIR" |
232 |
cp -a installer_files "$INSTALLER_DIR" |
233 |
|
234 |
cp -aR ../launcher/izpack-launcher-1.3/dist/* "$INSTALLER_DIR" |
235 |
rm -f "$INSTALLER_DIR"/install.bat |
236 |
|
237 |
find "$INSTALLER_DIR" -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true |
238 |
|
239 |
## hacemos las sustituciones de la variable |
240 |
sed "s/%JARNAME%/$JARNAME/" "$INSTALLER_DIR"/launcher-Win32.ini > "$INSTALLER_DIR"/launcher-Win32.ini.bak |
241 |
mv "$INSTALLER_DIR"/launcher-Win32.ini.bak "$INSTALLER_DIR"/launcher-Win32.ini; |
242 |
|
243 |
|
244 |
mv "$JARNAME" "$INSTALLER_DIR" |
245 |
cd "$INSTALLER_DIR" |
246 |
|
247 |
if [ -f "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" ] ; then |
248 |
rm -f "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" |
249 |
fi |
250 |
"$DIR_BASE"/launcher/7z/7za a -r "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" * |
251 |
cd - |
252 |
sed "s/%TITLE%/$APPNAME-$BRIEFVERSION\_$BUILDNUMBER/" ../launcher/7z/dist_config.txt > dist_config.txt |
253 |
cat ../launcher/7z/7zS.sfx dist_config.txt "$WINDOWSZIP" > "$WINDOWSEXE" |
254 |
|
255 |
### paquete con los instalables de JRE, Jai y Jai i/o |
256 |
"$DIR_BASE"/launcher/7z/7za a "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" "$DIR_BASE"/"$DIR_WIN"/jre_installers/*.exe |
257 |
cat ../launcher/7z/7zS.sfx dist_config.txt "$WINDOWSZIP" > "$WINDOWSEXEWITHJRE" |
258 |
|
259 |
### |
260 |
|
261 |
|
262 |
rm dist_config.txt |
263 |
rm "$WINDOWSZIP" |
264 |
|
265 |
rm -Rf "$INSTALLER_DIR" |
266 |
|
267 |
mv "$WINDOWSEXE" "$OUTPUT_DIR" |
268 |
mv "$WINDOWSEXEWITHJRE" "$OUTPUT_DIR" |
269 |
|
270 |
# Limpiamos tmpResources |
271 |
cd "$DIR_BASE"/"$DIR_WIN" |
272 |
rm -r ./tmpResources |
273 |
cd - |
274 |
|
275 |
|
276 |
## Para Mac |
277 |
echo "- Mac" |
278 |
if type ant 2>/dev/null >/dev/null; then |
279 |
cd "$DIR_BASE"/"$DIR_MAC" |
280 |
if ant -Dbuild.number="$BUILDNUMBER" -f build-10_3.xml; then |
281 |
zip -r "$MAC_10_3_ZIP" "gvSIG 1_0.app" |
282 |
rm -r "gvSIG 1_0.app" |
283 |
mv "$MAC_10_3_ZIP" "$OUTPUT_DIR" |
284 |
else |
285 |
echo "No se ha generado el paquete para Mac 10.3 . Compruebe que su ant tiene jarbundler instalado" |
286 |
fi |
287 |
|
288 |
if ant -Dbuild.number="$BUILDNUMBER" -f build-10_4.xml; then |
289 |
zip -r "$MAC_10_4_ZIP" "gvSIG 1_0.app" |
290 |
rm -r "gvSIG 1_0.app" |
291 |
mv "$MAC_10_4_ZIP" "$OUTPUT_DIR" |
292 |
else |
293 |
echo "No se ha generado el paquete para Mac 10.4. Compruebe que su ant tiene jarbundler instalado" |
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 |
cd "$DIR_BASE" |