[commit] r2141 - resolve symlinks in bindir; fix missing error function

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[commit] r2141 - resolve symlinks in bindir; fix missing error function

commits-3
 
Author: piumarta
Date: 2009-09-18 13:17:51 -0700 (Fri, 18 Sep 2009)
New Revision: 2141

Modified:
   trunk/platforms/unix/ChangeLog
   trunk/platforms/unix/cmake/squeak.in
Log:
resolve symlinks in bindir; fix missing error function

Modified: trunk/platforms/unix/ChangeLog
===================================================================
--- trunk/platforms/unix/ChangeLog 2009-09-17 17:10:27 UTC (rev 2140)
+++ trunk/platforms/unix/ChangeLog 2009-09-18 20:17:51 UTC (rev 2141)
@@ -1,3 +1,8 @@
+2009-09-18    <[hidden email]>
+
+ * cmake/squeak.in: Resolve symlinks in bindir.  Fix missing
+ 'error' function.
+
 2009-09-17    <[hidden email]>
 
  * cmake/Plugins.cmake: Set ${plugin}_disabled for each plugin,

Modified: trunk/platforms/unix/cmake/squeak.in
===================================================================
--- trunk/platforms/unix/cmake/squeak.in 2009-09-17 17:10:27 UTC (rev 2140)
+++ trunk/platforms/unix/cmake/squeak.in 2009-09-18 20:17:51 UTC (rev 2141)
@@ -3,13 +3,29 @@
 # Launch squeakvm from the command line or a menu script, with a good
 # plugin path, text encodings and pulseaudio kludge
 #
-# Last edited: 2009-09-17 10:05:45 by piumarta on ubuntu.piumarta.com
+# Last edited: 2009-09-18 13:14:40 by piumarta on ubuntu.piumarta.com
 
 PATH=/usr/bin:/bin
 
-bindir=`dirname $0`
-bindir=`cd ${bindir}; pwd`
-prefix=`dirname ${bindir}`
+realpath () {
+    path="$1"
+    while test -L "${path}"; do
+ dir=`dirname "${path}"`
+ dir=`cd "${dir}" && pwd -P`
+ path=`basename "${path}"`
+ path=`ls -l "${dir}/${path}" | sed 's,.* -> ,,'`
+ path="${dir}/${path}"
+    done
+    if test -d "${path}"; then
+ (cd "${path}" && pwd -P)
+    else
+ (cd `dirname "${path}"` && echo "`pwd -P`/`basename "${path}"`")
+    fi
+}
+
+bindir=`realpath "${0}"`
+bindir=`dirname  "${bindir}"`
+prefix=`dirname  "${bindir}"`
 libdir="${prefix}/lib/squeak"
 plgdir="${libdir}/[version]"
 useoss="[useoss]"
@@ -32,11 +48,11 @@
 elif test -x "${bindir}/${vm}"; then # bld/squeak -> bld/squeakvm
     vm="${bindir}/${vm}"
     plugins="${bindir}/%n"
-elif test -x "`which ${vm}`"; then
-    vm="`which ${vm}`"
+elif test -x `which ${vm}`; then
+    vm=`which ${vm}`
     plugins=""
 else    
-    error "cannot find ${vm}"
+    echo "cannot find ${vm}" >&2
     exit 1
 fi