svn-gvsig-desktop / trunk / install / distribucion.sh @ 6183
History | View | Annotate | Download (6.62 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_alpha |
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 |
WINDOWSZIP="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-windows-i586.7z |
40 |
LINUXZIP="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-linux-i586.tgz |
41 |
|
42 |
WINDOWSEXE="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-windows-i586.exe |
43 |
|
44 |
#Directorios |
45 |
#OUTPUT_DIR=/mnt/sercartlin/grupo-sig-ca/Testing/Versiones/v"$FULLVERSION"\_"$BUILDNUMBER" |
46 |
OUTPUT_DIR="$TARGET_DIR"/v"$FULLVERSION"\_"$BUILDNUMBER" |
47 |
PATH_SOURCE_EXT=../_fwAndami/gvSIG/extensiones |
48 |
PATH_SOURCE_MANDAT_EXT=../../../../../_fwAndami/gvSIG/extensiones |
49 |
|
50 |
|
51 |
echo "*****************" |
52 |
echo " BASE " |
53 |
echo "*****************" |
54 |
# Para Linux |
55 |
echo -n "$DIR_BASE"/"$DIR_LIN" "-- " |
56 |
cd "$DIR_BASE"/"$DIR_LIN" |
57 |
rm bin -rf |
58 |
mkdir -p bin/gvSIG/extensiones |
59 |
cp installer_files/LEEME installer_files/LLIG-ME installer_files/README bin |
60 |
cp resources/gpl.txt bin |
61 |
# No enlazamos directamente el directorio lib para no incluir el directorio CVS |
62 |
mkdir -p bin/lib |
63 |
cd "$DIR_BASE"/"$DIR_LIN"/bin/lib |
64 |
for i in ../../../../_fwAndami/lib/*.jar ; do |
65 |
ln -s "$i" . |
66 |
done |
67 |
for i in ../../../../_fwAndami/lib/*.zip ; do |
68 |
ln -s "$i" . |
69 |
done |
70 |
cd "$DIR_BASE"/"$DIR_LIN" |
71 |
ln -s ../../../_fwAndami/andami.jar bin/ |
72 |
cp resources/andami-config.xml bin |
73 |
echo OK. |
74 |
|
75 |
|
76 |
# Para Windows |
77 |
echo -n "$DIR_BASE"/"$DIR_WIN" "-- " |
78 |
cd "$DIR_BASE"/"$DIR_WIN" |
79 |
rm bin -rf |
80 |
mkdir -p bin/gvSIG/extensiones |
81 |
cp installer_files/LEEME.txt installer_files/LLIG-ME.txt installer_files/README.txt bin |
82 |
cp resources/gpl.txt bin |
83 |
# No enlazamos directamente el directorio lib para no incluir el directorio CVS |
84 |
mkdir -p bin/lib |
85 |
cd "$DIR_BASE"/"$DIR_WIN"/bin/lib |
86 |
for i in ../../../../_fwAndami/lib/*.jar ; do |
87 |
ln -s "$i" . |
88 |
done |
89 |
for i in ../../../../_fwAndami/lib/*.zip ; do |
90 |
ln -s "$i" . |
91 |
done |
92 |
cd "$DIR_BASE"/"$DIR_WIN" |
93 |
ln -s ../../../_fwAndami/andami.jar bin |
94 |
cp resources/andami-config.xml bin |
95 |
echo OK. |
96 |
|
97 |
# Estas extensiones se copian directamente al directorio destino, ya que no vamos a dar |
98 |
# opcion a no instalarlas, son obligatorias |
99 |
cd $DIR_BASE |
100 |
i=0 |
101 |
while [ ! -z ${MANDATORY_EXTENSIONS[$i]} ] |
102 |
do |
103 |
echo ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_LIN"/bin/gvSIG/extensiones |
104 |
ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_LIN"/bin/gvSIG/extensiones |
105 |
echo ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_WIN"/bin/gvSIG/extensiones |
106 |
ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_WIN"/bin/gvSIG/extensiones |
107 |
i=`expr $i + 1` |
108 |
done |
109 |
|
110 |
|
111 |
echo "*****************" |
112 |
[ $LOC = "es" ] && echo " EXTENSIONES " |
113 |
[ $LOC != "es" ] && echo " EXTENSIONS " |
114 |
echo "*****************" |
115 |
|
116 |
rm -rf $DIR_LIN/extensiones |
117 |
mkdir $DIR_LIN/extensiones |
118 |
rm -rf $DIR_WIN/extensiones |
119 |
mkdir $DIR_WIN/extensiones |
120 |
|
121 |
i=0 |
122 |
while [ ! -z ${EXTENSIONS[$i]} ] |
123 |
do |
124 |
[ $LOC = "es" ] && echo "Copiando "${EXTENSIONS[$i]} |
125 |
[ $LOC != "es" ] && echo "Copying "${EXTENSIONS[$i]} |
126 |
echo cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_LIN"/extensiones -rf |
127 |
cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_LIN"/extensiones -rf |
128 |
echo cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_WIN"/extensiones -rf |
129 |
cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_WIN"/extensiones -rf |
130 |
i=`expr $i + 1` |
131 |
done |
132 |
|
133 |
|
134 |
echo "*****************" |
135 |
echo " INST-WIN " |
136 |
echo "*****************" |
137 |
# Generar el instalador (jar) para windows |
138 |
cd "$DIR_BASE"/"$DIR_WIN" |
139 |
rm "$JARNAME" -f |
140 |
ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME" |
141 |
|
142 |
echo "*****************" |
143 |
echo " INST-LIN " |
144 |
echo "*****************" |
145 |
# Generar el instalador (jar) para Linux |
146 |
cd "$DIR_BASE"/"$DIR_LIN" |
147 |
rm "$JARNAME" -f |
148 |
ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME" |
149 |
|
150 |
|
151 |
echo "******************" |
152 |
[ $LOC = "es" ] && echo " GENERAR DISTRIB " |
153 |
[ $LOC != "es" ] && echo " GENERATE DISTRIB " |
154 |
echo "******************" |
155 |
# Generar el tar.gz para Linux y el EXE para Windows |
156 |
|
157 |
mkdir -p "$OUTPUT_DIR" |
158 |
echo "- Linux" |
159 |
## Para Linux |
160 |
cd "$DIR_BASE"/"$DIR_LIN" |
161 |
rm -Rf "$INSTALLER_DIR" |
162 |
cp -a installer_files "$INSTALLER_DIR" |
163 |
rm -R "$INSTALLER_DIR"/CVS 2> /dev/null && true |
164 |
# Set the correct version number in the scripts and files |
165 |
if [ -f "$INSTALLER_DIR"/install.sh ] ; then |
166 |
sed "s/JARNAME/$JARNAME/" "$INSTALLER_DIR"/install.sh > "$INSTALLER_DIR"/install.sh.bak |
167 |
mv "$INSTALLER_DIR"/install.sh.bak "$INSTALLER_DIR"/install.sh ; |
168 |
chmod +x "$INSTALLER_DIR"/install.sh |
169 |
fi |
170 |
mv "$JARNAME" "$INSTALLER_DIR" |
171 |
tar -cvzf "$LINUXZIP" "$INSTALLER_DIR" |
172 |
rm -Rf "$INSTALLER_DIR" |
173 |
mv "$LINUXZIP" "$OUTPUT_DIR" |
174 |
|
175 |
|
176 |
## Para Windows |
177 |
echo "- Windows" |
178 |
#set -x |
179 |
cd "$DIR_BASE"/"$DIR_WIN" |
180 |
rm -Rf "$INSTALLER_DIR" |
181 |
cp -a installer_files "$INSTALLER_DIR" |
182 |
|
183 |
cp -aR ../launcher/izpack-launcher-1.3/dist/* "$INSTALLER_DIR" |
184 |
rm -f "$INSTALLER_DIR"/install.bat |
185 |
|
186 |
find "$INSTALLER_DIR" -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true |
187 |
|
188 |
## hacemos las sustituciones de la variable |
189 |
if [ -f "$INSTALLER_DIR"/launcher.ini ] ; then |
190 |
sed "s/%JARNAME%/$JARNAME/" "$INSTALLER_DIR"/launcher.ini > "$INSTALLER_DIR"/launcher.ini.bak |
191 |
mv "$INSTALLER_DIR"/launcher.ini.bak "$INSTALLER_DIR"/launcher.ini; |
192 |
fi |
193 |
|
194 |
mv "$JARNAME" "$INSTALLER_DIR" |
195 |
cd "$INSTALLER_DIR" |
196 |
|
197 |
if [ -f "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" ] ; then |
198 |
rm -f "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" |
199 |
fi |
200 |
"$DIR_BASE"/launcher/7z/7za a -r "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" * |
201 |
cd - |
202 |
sed "s/%TITLE%/$APPNAME-$BRIEFVERSION\_$BUILDNUMBER/" ../launcher/7z/dist_config.txt > dist_config.txt |
203 |
cat ../launcher/7z/7zS.sfx dist_config.txt "$WINDOWSZIP" > "$WINDOWSEXE" |
204 |
rm dist_config.txt |
205 |
#rm "$WINDOWSZIP" |
206 |
|
207 |
rm -Rf "$INSTALLER_DIR" |
208 |
|
209 |
mv "$WINDOWSEXE" "$OUTPUT_DIR" |