root / tags / v1_1_Build_1007 / extensions / extExpressionField / install / distribucion.sh @ 12478
History | View | Annotate | Download (6.88 KB)
1 |
#!/bin/bash |
---|---|
2 |
|
3 |
# Si se produce un error, salimos inmediatamente |
4 |
set -e |
5 |
|
6 |
|
7 |
# Obtenemos el locale |
8 |
LOC=`echo $LANG | sed 's/_.*//'` |
9 |
|
10 |
# Comprobar que estamos en el directorio adecuado |
11 |
if [ "$LOC" = "es" ] ; then |
12 |
ERROR_BASEDIR="Este script debe invocarse desde el directorio \'install\' del proyecto" |
13 |
else |
14 |
ERROR_BASEDIR="This script must be run from the \'install\' directory of the project" |
15 |
fi |
16 |
if [ ! -d ../../install/instalador-gvSIG-lin ] || [ ! -d ../../install/instalador-gvSIG-win ] || [ ! -d ../../_fwAndami ] ; then |
17 |
echo $ERROR_BASEDIR |
18 |
exit 1 ; |
19 |
fi |
20 |
|
21 |
DIR_BASE=`pwd` |
22 |
GVSIG_INSTALLDIR=`readlink -f ../../install` |
23 |
ANDAMI_DIR=`readlink -f ../../_fwAndami` |
24 |
|
25 |
source variables.sh |
26 |
# Get a version with format 1_0_alpha |
27 |
UNDERSCORE_VERSION=`echo $FULLVERSION | sed 'y/./_/'` |
28 |
# Get a version with format 10_alpha |
29 |
BRIEFVERSION=`echo $FULLVERSION | sed 's/\.//'` |
30 |
# The name of the dir which will be ZIPed, containing the resulting installer |
31 |
INSTALLER_DIR="$APPNAME"-$FULLVERSION\_installer |
32 |
JARNAME="$APPNAME"-"$FULLVERSION".jar |
33 |
# The extension targets on the this version of gvSIG: |
34 |
GVSIG_VERSION=1.0 |
35 |
|
36 |
BUILDNUMBER=`sed -n 's/build.number=//p' "$ANDAMI_DIR"/gvSIG/extensiones/"$MAIN_INSTALL_PLUGIN"/build.number` |
37 |
|
38 |
#ZIPNAME="$APPNAME"-"$UNDERSCORE_VERSION"\_"$BUILDNUMBER".zip |
39 |
DIR_LIN=. |
40 |
DIR_WIN=. |
41 |
|
42 |
DIR_LIN_GVSIG="$GVSIG_INSTALLDIR"/instalador-gvSIG-lin |
43 |
DIR_WIN_GVSIG="$GVSIG_INSTALLDIR"/instalador-gvSIG-win |
44 |
|
45 |
|
46 |
WINDOWSZIP="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-windows-i586.7z |
47 |
LINUXZIP="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-linux-i586.tgz |
48 |
|
49 |
LINUXBIN="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-linux-i586.bin |
50 |
|
51 |
WINDOWSEXE="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-windows-i586.exe |
52 |
|
53 |
#Directorios |
54 |
#OUTPUT_DIR=/mnt/sercartlin/grupo-sig-ca/Testing/Versiones/v"$FULLVERSION"\_"$BUILDNUMBER" |
55 |
OUTPUT_DIR="$TARGET_DIR"/v"$FULLVERSION"\_"$BUILDNUMBER" |
56 |
PATH_SOURCE_EXT="$ANDAMI_DIR"/gvSIG/extensiones |
57 |
|
58 |
|
59 |
echo "*****************" |
60 |
echo " BASE " |
61 |
echo "*****************" |
62 |
|
63 |
cd "$DIR_BASE"/ |
64 |
rm bin -rf |
65 |
mkdir -p bin/gvSIG/extensiones |
66 |
#cp "$DIR_WIN_GVSIG"/installer_files/LEEME "$DIR_WIN_GVSIG"installer_files/LLIG-ME "$DIR_WIN_GVSIG"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"/bin/lib |
71 |
for i in "$ANDAMI_DIR"/lib/*.jar ; do |
72 |
ln -s "$i" . |
73 |
done |
74 |
for i in "$ANDAMI_DIR"/lib/*.zip ; do |
75 |
ln -s "$i" . |
76 |
done |
77 |
cd "$DIR_BASE"/ |
78 |
ln -s "$ANDAMI_DIR"/andami.jar bin/ |
79 |
ln -s "$ANDAMI_DIR"/castor.properties bin/ |
80 |
#cp resources/andami-config.xml bin |
81 |
echo OK. |
82 |
|
83 |
|
84 |
# Para Windows |
85 |
#Copiamos el lanzador y sus tracuciones al tmpResources |
86 |
rm -Rf tmpResources |
87 |
mkdir tmpResources |
88 |
cp -R "$GVSIG_INSTALLDIR"/launcher/izpack-launcher-1.3/dist/* ./tmpResources |
89 |
mv ./tmpResources/launcher-Win32.exe ./tmpResources/gvSIG.exe |
90 |
#Quitamos el ini, manifest y los CVS |
91 |
rm ./tmpResources/*.ini ./tmpResources/*.manifest |
92 |
find ./tmpResources -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true |
93 |
echo OK. |
94 |
|
95 |
# Estas extensiones se copian directamente al directorio destino, ya que no vamos a dar |
96 |
# opcion a no instalarlas, son obligatorias |
97 |
cd "$DIR_BASE" |
98 |
i=0 |
99 |
while [ ! -z ${MANDATORY_EXTENSIONS[$i]} ] |
100 |
do |
101 |
echo ln -s "$PATH_SOURCE_EXT"/${MANDATORY_EXTENSIONS[$i]} bin/gvSIG/extensiones |
102 |
ln -s "$PATH_SOURCE_EXT"/${MANDATORY_EXTENSIONS[$i]} bin/gvSIG/extensiones |
103 |
i=`expr $i + 1` |
104 |
done |
105 |
|
106 |
echo "*****************" |
107 |
[ $LOC = "es" ] && echo " EXTENSIONES " |
108 |
[ $LOC != "es" ] && echo " EXTENSIONS " |
109 |
echo "*****************" |
110 |
|
111 |
rm -rf extensiones |
112 |
mkdir extensiones |
113 |
|
114 |
i=0 |
115 |
while [ ! -z ${EXTENSIONS[$i]} ] |
116 |
do |
117 |
[ $LOC = "es" ] && echo "Enlazando "${EXTENSIONS[$i]} |
118 |
[ $LOC != "es" ] && echo "Linking "${EXTENSIONS[$i]} |
119 |
echo ln -s "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} extensiones |
120 |
ln -s "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} extensiones |
121 |
i=`expr $i + 1` |
122 |
done |
123 |
|
124 |
echo "*****************" |
125 |
echo " INST " |
126 |
echo "*****************" |
127 |
# Generar el instalador (jar) |
128 |
cd "$DIR_BASE"/ |
129 |
rm "$JARNAME" -f |
130 |
ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME" |
131 |
|
132 |
|
133 |
echo "******************" |
134 |
[ $LOC = "es" ] && echo " GENERAR DISTRIB " |
135 |
[ $LOC != "es" ] && echo " GENERATE DISTRIB " |
136 |
echo "******************" |
137 |
# Generar el tar.gz para Linux y el EXE para Windows |
138 |
|
139 |
mkdir -p "$OUTPUT_DIR" |
140 |
echo "- Linux" |
141 |
## Nueva instalacion para linux |
142 |
rm -Rf "$INSTALLER_DIR" |
143 |
mkdir -p "$INSTALLER_DIR"/tmp_gvSIGInstall |
144 |
cp "$JARNAME" "$INSTALLER_DIR"/tmp_gvSIGInstall |
145 |
cd "$INSTALLER_DIR" |
146 |
chmod u+x "$GVSIG_INSTALLDIR"/launcher/izpack-launcher-1.3_linux/dist/launcher-Linux |
147 |
cp -R "$GVSIG_INSTALLDIR"/launcher/izpack-launcher-1.3_linux/dist/* ./tmp_gvSIGInstall |
148 |
chmod a+x ./tmp_gvSIGInstall/launcher-Linux |
149 |
find . -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true |
150 |
|
151 |
sed "s/%JARNAME%/$JARNAME/" ./tmp_gvSIGInstall/launcher.ini > ./tmp_gvSIGInstall/launcher.ini.bak |
152 |
mv ./tmp_gvSIGInstall/launcher.ini.bak ./tmp_gvSIGInstall/launcher.ini; |
153 |
|
154 |
tar -cvzf ./tmp.tgz ./tmp_gvSIGInstall |
155 |
echo '#!/bin/sh' > xx.tmp |
156 |
lcount=`cat xx.tmp "$GVSIG_INSTALLDIR"/launcher/izpack-launcher-1.3_linux/h_gvSIG-install.sh | wc -l` |
157 |
lcount=$(($lcount+2)) # sumamos dos: uno por la linea siguiente y otro para el inicio |
158 |
echo "lcount=$lcount" >> xx.tmp |
159 |
cat xx.tmp "$GVSIG_INSTALLDIR"/launcher/izpack-launcher-1.3_linux/h_gvSIG-install.sh ./tmp.tgz > "$LINUXBIN" |
160 |
rm xx.tmp |
161 |
chmod a+x "$LINUXBIN" |
162 |
mv "$LINUXBIN" "$OUTPUT_DIR" |
163 |
cd "$DIR_BASE"/ |
164 |
rm -Rf "$INSTALLER_DIR" |
165 |
## Fin Nueva instalacion para linux |
166 |
|
167 |
## Para Windows |
168 |
echo "- Windows" |
169 |
#set -x |
170 |
cd "$DIR_BASE" |
171 |
rm -Rf "$INSTALLER_DIR" |
172 |
|
173 |
mkdir "$INSTALLER_DIR" |
174 |
cp -aR "$GVSIG_INSTALLDIR"/launcher/izpack-launcher-1.3/dist/* "$INSTALLER_DIR" |
175 |
rm -f "$INSTALLER_DIR"/install.bat |
176 |
|
177 |
find "$INSTALLER_DIR" -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true |
178 |
|
179 |
## hacemos las sustituciones de la variable |
180 |
sed "s/%JARNAME%/$JARNAME/" "$INSTALLER_DIR"/launcher-Win32.ini > "$INSTALLER_DIR"/launcher-Win32.ini.bak |
181 |
mv "$INSTALLER_DIR"/launcher-Win32.ini.bak "$INSTALLER_DIR"/launcher-Win32.ini; |
182 |
|
183 |
|
184 |
mv "$JARNAME" "$INSTALLER_DIR" |
185 |
cd "$INSTALLER_DIR" |
186 |
|
187 |
if [ -f "$DIR_BASE"/"$WINDOWSZIP" ] ; then |
188 |
rm -f "$DIR_BASE"/"$WINDOWSZIP" |
189 |
fi |
190 |
chmod u+x "$GVSIG_INSTALLDIR"/launcher/7z/7za |
191 |
"$GVSIG_INSTALLDIR"/launcher/7z/7za a -r "$DIR_BASE"/"$WINDOWSZIP" * |
192 |
cd - |
193 |
sed "s/%TITLE%/$APPNAME-$BRIEFVERSION\_$BUILDNUMBER/" "$GVSIG_INSTALLDIR"/launcher/7z/dist_config.txt > dist_config.txt |
194 |
cat "$GVSIG_INSTALLDIR"/launcher/7z/7zS.sfx dist_config.txt "$WINDOWSZIP" > "$WINDOWSEXE" |
195 |
|
196 |
### |
197 |
|
198 |
|
199 |
rm dist_config.txt |
200 |
rm "$WINDOWSZIP" |
201 |
|
202 |
rm -Rf "$INSTALLER_DIR" |
203 |
|
204 |
mv "$WINDOWSEXE" "$OUTPUT_DIR" |
205 |
|
206 |
# Limpiamos tmpResources |
207 |
cd "$DIR_BASE"/ |
208 |
rm -r ./tmpResources |
209 |
cd - |
210 |
|
211 |
## Limpiamos |
212 |
|
213 |
rm -rf extensiones |
214 |
rm -rf bin |
215 |
|
216 |
echo "******************" |
217 |
[ $LOC = "es" ] && echo " GENERAR FUENTES " |
218 |
[ $LOC != "es" ] && echo " GENERATE SOURCES " |
219 |
echo "******************" |
220 |
|
221 |
cd .. |
222 |
ant generate-source-package |
223 |
mv dist-src/gv*-src.zip "$OUTPUT_DIR" |
224 |
cd - |
225 |
|
226 |
|
227 |
echo "*****************" |
228 |
echo " FIN " |
229 |
echo "*****************" |
230 |
|
231 |
echo "" |
232 |
echo "Generados los ficheros:" |
233 |
echo "$OUTPUT_DIR" |
234 |
ls -lh "$OUTPUT_DIR" |
235 |
cd "$DIR_BASE" |