aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-07-28 11:26:35 +0200
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-03 16:06:43 +0200
commit2b739a6b9ee86f566e1c25a08ff11e6927cc2979 (patch)
tree654b0eb91671be7d2a235bbe79dfa69da087b345 /bin
parent0814beae5f58cfadbfdf5cb68164b974bee545f3 (diff)
Fix running the qtcreator script with traditional Bourne shell.
First, there's no $( ) for subshells. You have to use backticks. Second problem, "VAR=value exec command" doesn't work. Split into variable setting, exporting and then exec'ing the program. Third, Solaris doesn't come with readlink, so parse the output of ls -l.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/qtcreator37
1 files changed, 34 insertions, 3 deletions
diff --git a/bin/qtcreator b/bin/qtcreator
index c142ea825a..b5f4f945d5 100755
--- a/bin/qtcreator
+++ b/bin/qtcreator
@@ -1,5 +1,36 @@
#!/bin/sh
-bindir=$(dirname "$(readlink -nf $0)")
-libdir=$(cd "${bindir}/../lib" ; pwd)
-LD_LIBRARY_PATH="${libdir}/qtcreator:${LD_LIBRARY_PATH}" exec "${bindir}/qtcreator.bin" ${1+"$@"}
+function makeAbsolute() {
+ case "$1" in
+ /*)
+ # already absolute, return it
+ echo "$1"
+ ;;
+ *)
+ # relative, prepend $2 made absolute
+ echo `makeAbsolute "$2" "$PWD"`/"$1" | sed 's,/\.$,,'
+ ;;
+ esac
+}
+
+if test -L "$0"; then
+ # Try readlink(1)
+ readlink=`type readlink 2>/dev/null` || readlink=
+ if test -n "$readlink"; then
+ # We have readlink(1), so we can use it
+ me=`readlink -nf "$0"`
+ else
+ # No readlink(1), so let's try ls -l
+ me=`ls -l "$0" | sed 's/^.*-> //'`
+ base=`dirname "$0"`
+ me=`makeAbsolute "$me" "$base"`
+ fi
+else
+ me="$0"
+fi
+
+bindir=`dirname "$me"`
+libdir=`cd "${bindir}/../lib" ; pwd`
+LD_LIBRARY_PATH="${libdir}/qtcreator:${LD_LIBRARY_PATH}"
+export LD_LIBRARY_PATH
+exec "${bindir}/qtcreator.bin" ${1+"$@"}