summaryrefslogtreecommitdiff
path: root/indra/newview/linux_tools
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/linux_tools')
-rwxr-xr-xindra/newview/linux_tools/wrapper.sh42
1 files changed, 26 insertions, 16 deletions
diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh
index 283a28a0aa..20936c6460 100755
--- a/indra/newview/linux_tools/wrapper.sh
+++ b/indra/newview/linux_tools/wrapper.sh
@@ -110,22 +110,34 @@ export SAVED_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}"
# fi
#fi
-export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib:"${LD_LIBRARY_PATH}"'
-export SL_CMD='$LL_WRAPPER bin/do-not-directly-run-secondlife-bin'
-export SL_OPT="`cat etc/gridargs.dat` $@"
-
-# Run the program
-eval ${SL_ENV} ${SL_CMD} ${SL_OPT} || LL_RUN_ERR=runerr
+export LD_LIBRARY_PATH="$PWD/lib:${LD_LIBRARY_PATH}"
+
+# Have to deal specially with gridargs.dat; typical contents look like:
+# --channel "Second Life Developer" --settings settings_developer.xml
+# Simply embedding $(<etc/gridargs.dat) into a command line treats each of
+# Second, Life and Developer as separate args -- no good. We need bash to
+# process quotes using eval.
+# First read it without scanning, then scan that string. Break quoted words
+# into a bash array. Note that if gridargs.dat is empty, or contains only
+# whitespace, the resulting gridargs array will be empty -- zero entries --
+# therefore "${gridargs[@]}" entirely vanishes from the command line below,
+# just as we want.
+eval gridargs=("$(<etc/gridargs.dat)")
+
+# Run the program.
+# Don't quote $LL_WRAPPER because, if empty, it should simply vanish from the
+# command line. But DO quote "$@": preserve separate args as individually
+# quoted. Similar remarks about the contents of gridargs.
+$LL_WRAPPER bin/do-not-directly-run-secondlife-bin "${gridargs[@]}" "$@"
+LL_RUN_ERR=$?
# Handle any resulting errors
-if [ -n "$LL_RUN_ERR" ]; then
- LL_RUN_ERR_MSG=""
- if [ "$LL_RUN_ERR" = "runerr" ]; then
- # generic error running the binary
- echo '*** Bad shutdown. ***'
- if [ "`uname -m`" = "x86_64" ]; then
- echo
- cat << EOFMARKER
+if [ $LL_RUN_ERR -ne 0 ]; then
+ # generic error running the binary
+ echo '*** Bad shutdown ($LL_RUN_ERR). ***'
+ if [ "$(uname -m)" = "x86_64" ]; then
+ echo
+ cat << EOFMARKER
You are running the Second Life Viewer on a x86_64 platform. The
most common problems when launching the Viewer (particularly
'bin/do-not-directly-run-secondlife-bin: not found' and 'error while
@@ -134,10 +146,8 @@ distribution's 32-bit compatibility packages.
For example, on Ubuntu and other Debian-based Linuxes you might run:
$ sudo apt-get install ia32-libs ia32-libs-gtk ia32-libs-kde ia32-libs-sdl
EOFMARKER
- fi
fi
fi
-
echo
echo '*******************************************************'