From e9a22d5165c2dda5a0e10506977081222549a8eb Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 14 Oct 2012 08:55:36 +0200 Subject: o Making sure ./app can be symlinked to an installation. o More tests. --- app | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app b/app index dc70ab0..0c4cbd1 100755 --- a/app +++ b/app @@ -2,6 +2,20 @@ set -e +PRG="$0" +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi +done + +APPSH_HOME=`dirname "$PRG"` +APPSH_HOME=`cd "$APPSH_HOME" && pwd` + if [ -z "$BASEDIR" ] then BASEDIR=`dirname $0` @@ -28,10 +42,10 @@ method_usage() { echo "Run $0 -h for more help" >&2 } -. $BASEDIR/.app/lib/app-common -. $BASEDIR/.app/lib/app-app -. $BASEDIR/.app/lib/app-conf -. $BASEDIR/.app/lib/app-operate +. $APPSH_HOME/.app/lib/app-common +. $APPSH_HOME/.app/lib/app-app +. $APPSH_HOME/.app/lib/app-conf +. $APPSH_HOME/.app/lib/app-operate main() { local method -- cgit v1.2.3