Revision 43116 trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/resources-application/gvSIG.sh
gvSIG.sh | ||
---|---|---|
38 | 38 |
#set -x |
39 | 39 |
set -e |
40 | 40 |
|
41 |
if [ "$BASH_VERSION" = "" ] ; then |
|
42 |
echo "gvSIG.sh is not running with a bash shell" |
|
43 |
if type bash 2>/dev/null ; then |
|
44 |
echo "Relaunch gvSIG.sh with a bash shell." |
|
45 |
exec bash $@ |
|
46 |
else |
|
47 |
echo "Can't locate a bash, continue the execution with current shell." |
|
48 |
fi |
|
49 |
fi |
|
50 |
|
|
41 | 51 |
onerror() { |
42 | 52 |
set +x |
43 | 53 |
echo "Error executing the command:" |
... | ... | |
51 | 61 |
# Identify OS and Architecture # |
52 | 62 |
#################### |
53 | 63 |
|
54 |
UNAME=$(uname -p -o | tr '[:upper:]' '[:lower:]')
|
|
64 |
UNAME=$(uname -m -o | tr '[:upper:]' '[:lower:]')
|
|
55 | 65 |
case "$UNAME" in |
56 | 66 |
*darwin*) |
57 | 67 |
OS="darwin" |
... | ... | |
157 | 167 |
export GVSIG_HOME_FOLDER="$HOME/$GVSIG_APPLICATION_NAME" |
158 | 168 |
fi |
159 | 169 |
|
160 |
export GVSIG_TEMP |
|
161 |
|
|
162 | 170 |
#################### |
163 | 171 |
# Load config file # |
164 | 172 |
#################### |
165 | 173 |
|
174 |
update_user_preferences() { |
|
175 |
if [ "$GVSIG_HOME_FOLDER" = "$GVSIG_INSTALL_FOLDER/preferences" ] ; then |
|
176 |
# It is a portable using the installation preferences folder as the user preferences folder. |
|
177 |
# We do not do anything. |
|
178 |
return |
|
179 |
fi |
|
180 |
if [ ! -d "$GVSIG_INSTALL_FOLDER/preferences" ] ; then |
|
181 |
# There is no installation preference folder. We do not do anything. |
|
182 |
return |
|
183 |
fi |
|
184 |
|
|
185 |
echo "Updating preferences in personal folder..." |
|
186 |
echo "This may take a moment." |
|
187 |
|
|
188 |
if [ ! -d "$GVSIG_HOME_FOLDER" ] ; then |
|
189 |
# There is no folder with the gvSIG preferences in the user's folder. |
|
190 |
# We copy the preferences folder of the gvSIG installation. |
|
191 |
echo "Copying the default gvSIG preferences to the user's folder." |
|
192 |
xmkdir -p "$GVSIG_HOME_FOLDER" |
|
193 |
cp -a "$GVSIG_INSTALL_FOLDER/preferences/$GVSIG_APPLICATION_NAME" "$GVSIG_HOME_FOLDER/.." |
|
194 |
echo "Updating preferences finished." |
|
195 |
return |
|
196 |
fi |
|
197 |
# The user already has their preferences in their personal folder. |
|
198 |
# We check if we have to copy some preferences that do not have: |
|
199 |
# - Preferences of some plugin that does not have |
|
200 |
# - Missing symbols |
|
201 |
# - Scripts |
|
202 |
|
|
203 |
# |
|
204 |
# Check if some plugin preferences are missing, and copy them |
|
205 |
cd "$GVSIG_INSTALL_FOLDER/preferences/$GVSIG_APPLICATION_NAME/plugins" |
|
206 |
for FOLDER in * |
|
207 |
do |
|
208 |
if [ -d "$FOLDER" -a ! -d "$GVSIG_HOME_FOLDER/plugins/$FOLDER" ] ; then |
|
209 |
echo "Copying the default $FOLDER preferences to the user's folder." |
|
210 |
xmkdir -p "$GVSIG_HOME_FOLDER/plugins/$FOLDER" |
|
211 |
cp -a "$GVSIG_INSTALL_FOLDER/preferences/$GVSIG_APPLICATION_NAME/plugins/$FOLDER" "$GVSIG_HOME_FOLDER/plugins" |
|
212 |
fi |
|
213 |
done |
|
214 |
|
|
215 |
# |
|
216 |
# Check if any symbols are missing and copy them |
|
217 |
cd "$GVSIG_INSTALL_FOLDER/preferences/$GVSIG_APPLICATION_NAME/plugins/org.gvsig.app.mainplugin/Symbols" |
|
218 |
for FOLDER in * |
|
219 |
do |
|
220 |
if [ -d "$FOLDER" -a ! -d "$GVSIG_HOME_FOLDER/plugins/org.gvsig.app.mainplugin/Symbols/$FOLDER" ] ; then |
|
221 |
echo "Copying the default $FOLDER symbol to the user's folder." |
|
222 |
xmkdir -p "$GVSIG_HOME_FOLDER/plugins/org.gvsig.app.mainplugin/Symbols/$FOLDER" |
|
223 |
cp -a "$GVSIG_INSTALL_FOLDER/preferences/$GVSIG_APPLICATION_NAME/plugins/org.gvsig.app.mainplugin/Symbols/$FOLDER" "$GVSIG_HOME_FOLDER/plugins/org.gvsig.app.mainplugin/Symbols" |
|
224 |
fi |
|
225 |
done |
|
226 |
|
|
227 |
# |
|
228 |
# Check if any script are missing and copy them |
|
229 |
cd "$GVSIG_INSTALL_FOLDER/preferences/$GVSIG_APPLICATION_NAME/plugins/org.gvsig.scripting.app.mainplugin/scripts/addons" |
|
230 |
for FOLDER in * |
|
231 |
do |
|
232 |
if [ -d "$FOLDER" -a ! -d "$GVSIG_HOME_FOLDER/plugins/org.gvsig.scripting.app.mainplugin/scripts/addons/$FOLDER" ] ; then |
|
233 |
echo "Copying the default $FOLDER script to the user's folder." |
|
234 |
xmkdir -p "$GVSIG_HOME_FOLDER/plugins/org.gvsig.scripting.app.mainplugin/scripts/addons/$FOLDER" |
|
235 |
cp -a "$GVSIG_INSTALL_FOLDER/preferences/$GVSIG_APPLICATION_NAME/plugins/org.gvsig.scripting.app.mainplugin/scripts/addons/$FOLDER" "$GVSIG_HOME_FOLDER/plugins/org.gvsig.scripting.app.mainplugin/scripts/addons" |
|
236 |
fi |
|
237 |
done |
|
238 |
|
|
239 |
echo "Updating preferences finished." |
|
240 |
} |
|
241 |
|
|
242 |
|
|
166 | 243 |
if [ -f "$GVSIG_INSTALL_FOLDER/gvSIG.config" ] ; then |
167 | 244 |
. "$GVSIG_INSTALL_FOLDER/gvSIG.config" |
168 | 245 |
fi |
... | ... | |
170 | 247 |
. "$GVSIG_HOME_FOLDER/gvSIG.config" |
171 | 248 |
fi |
172 | 249 |
|
250 |
update_user_preferences |
|
251 |
|
|
173 | 252 |
if [ ! -d "$GVSIG_HOME_FOLDER" ] ; then |
174 | 253 |
xmkdir -p "$GVSIG_HOME_FOLDER" |
175 | 254 |
fi |
... | ... | |
216 | 295 |
pf_foundArch="" |
217 | 296 |
pf_fname="" |
218 | 297 |
cd "$GVSIG_INSTALL_FOLDER" |
219 |
find . -name package.info | while read pf_fname |
|
298 |
find . -name package.info 2>/dev/null | while read pf_fname
|
|
220 | 299 |
do |
221 | 300 |
cat "$pf_fname" |
222 | 301 |
done | grep "architecture=[^a]" | sort | head -n 1 | read pf_foundArch || true |
Also available in: Unified diff