sb126: #i112542# resolve $0 symlinks recursively in start scripts (based on a patch by pooryorick)

This commit is contained in:
sb 2010-06-23 10:45:22 +02:00
parent 4740aded6e
commit c6d6e6bf9f
3 changed files with 23 additions and 26 deletions

View File

@ -43,15 +43,14 @@ export SAL_ENABLE_FILE_LOCKING
#@# export JITC_PROCESSOR_TYPE=6 #@# export JITC_PROCESSOR_TYPE=6
# resolve installation directory # resolve installation directory
sd_cwd="`pwd`" sd_cwd=`pwd`
if [ -h "$0" ] ; then sd_res=$0
sd_basename=`basename "$0"` while [ -h "$sd_res" ] ; do
sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"` cd "`dirname "$sd_res"`"
cd "`dirname "$0"`" sd_basename=`basename "$sd_res"`
cd "`dirname "$sd_script"`" sd_res=`ls -l "$sd_basename" | sed "s/.*$sd_basename -> //g"`
else done
cd "`dirname "$0"`" cd "`dirname "$sd_res"`"
fi
sd_prog=`pwd` sd_prog=`pwd`
cd "$sd_cwd" cd "$sd_cwd"

View File

@ -29,14 +29,13 @@
set -e set -e
# resolve installation directory # resolve installation directory
if [ -h "$0" ] ; then sd_res=$0
sd_basename=`basename "$0"` while [ -h "$sd_res" ] ; do
sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"` cd "`dirname "$sd_res"`"
cd "`dirname "$0"`" sd_basename=`basename "$sd_res"`
cd "`dirname "$sd_script"`" sd_res=`ls -l "$sd_basename" | sed "s/.*$sd_basename -> //g"`
else done
cd "`dirname "$0"`" cd "`dirname "$sd_res"`"
fi
sd_prog=`pwd` sd_prog=`pwd`
case $1 in case $1 in

View File

@ -31,15 +31,14 @@ SAL_ENABLE_FILE_LOCKING=1
export SAL_ENABLE_FILE_LOCKING export SAL_ENABLE_FILE_LOCKING
# resolve installation directory # resolve installation directory
sd_cwd="`pwd`" sd_cwd=`pwd`
if [ -h "$0" ] ; then sd_res=$0
sd_basename=`basename "$0"` while [ -h "$sd_res" ] ; do
sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"` cd "`dirname "$sd_res"`"
cd "`dirname "$0"`" sd_basename=`basename "$sd_res"`
cd "`dirname "$sd_script"`" sd_res=`ls -l "$sd_basename" | sed "s/.*$sd_basename -> //g"`
else done
cd "`dirname "$0"`" cd "`dirname "$sd_res"`"
fi
sd_prog=`pwd` sd_prog=`pwd`
cd "$sd_cwd" cd "$sd_cwd"