forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cross...@apache.org
Subject svn commit: rev 43359 - forrest/trunk/src/core/bin
Date Sun, 05 Sep 2004 02:32:41 GMT
Author: crossley
Date: Sat Sep  4 19:32:40 2004
New Revision: 43359

Modified:
   forrest/trunk/src/core/bin/forrest
Log:
1. The determination of FORREST_HOME works correctly if the symlink
to forrest is a relative pathname.
2. Removes the bash specific bits and replaces it with code that will work
under the Bourne Shell.
Issue: FOR-251
Submitted by: Rick Tessner


Modified: forrest/trunk/src/core/bin/forrest
==============================================================================
--- forrest/trunk/src/core/bin/forrest	(original)
+++ forrest/trunk/src/core/bin/forrest	Sat Sep  4 19:32:40 2004
@@ -36,9 +36,23 @@
 
 if [ -z "$FORREST_HOME" ] ; then
   # use the location of this script to infer $FORREST_HOME
-  realpath_listing=$(ls -l $0)
-  realpath="${realpath_listing#*-> }" # strip everything before '-> '
-  realpath="/${realpath#*/}" # strip before '/' in case there wasn't a ->
+  whoami=`basename $0`
+  whereami=`echo $0 | sed -e "s#^[^/]#\`pwd\`/&#"`
+  whereami=`dirname $whereami`
+
+  # Resolve any symlinks of the now absolute path, $whereami
+  realpath_listing=`ls -l $whereami/$whoami`
+  case "$realpath_listing" in
+    *-\>\ /*)
+      realpath=`echo $realpath_listing | sed -e "s#^.*-> ##"`
+      ;;
+    *-\>*)
+      realpath=`echo $realpath_listing | sed -e "s#^.*-> #$whereami/#"`
+      ;;
+    *)
+      realpath=$whereami/$whoami
+      ;;
+  esac
   FORREST_HOME=`dirname "$realpath"`/..
 fi
 

Mime
View raw message