From a4215743db91c4b7050dfda32a670814a101b773 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 27 Jan 2013 21:10:30 +0100 Subject: Defining 'APP_HOME' as where the .app dir is. The tools should use this value to find files. app-operate/app-operator-pid: These are "functional" now. --- lib/common | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/common b/lib/common index d53f0cf..e90f77b 100644 --- a/lib/common +++ b/lib/common @@ -16,15 +16,16 @@ assert_is_app() { esac done - if [ ! -d .app ] + local app_home=${APP_HOME-.} + + if [ ! -d "$app_home/.app" ] then - echo "This is not an app, missing directory: '.app'" >&2 - exit 1 + fatal "This is not an app, missing directory: .app" fi if [[ $check_link == yes ]] then - if [ ! -e current ] + if [ ! -e "$app_home/current" ] then fatal "Missing 'current' link." >&2 fi @@ -32,7 +33,7 @@ assert_is_app() { if [[ $version != "" ]] then - if [[ ! -d versions/$version ]] + if [[ ! -d "$app_home/versions/$version" ]] then fatal "No such version: $version" fi @@ -160,17 +161,19 @@ run_app() { done local bin=$1; shift - local e=`app-cat-conf -f .app/config -n "env\..*" | cut -f 2- -d .` + local e=`app-cat-conf -n "env\..*" | cut -f 2- -d .` + + local app_home=`pwd` ( - if [[ $version == "" ]] - then - assert_is_app - cd current - else - assert_is_app -v "$version" - cd "versions/$version" - fi + if [[ $version == "" ]] + then + assert_is_app + cd current + else + assert_is_app -v "$version" + cd "versions/$version" + fi # This magically get the expansion of $u correct. IFS=" @@ -182,7 +185,8 @@ run_app() { PATH=/bin:/usr/bin \ $e \ PWD="$PWD" \ - APPSH_HOME=$APPSH_HOME \ + APPSH_HOME="$APPSH_HOME" \ + APP_HOME="$app_home" \ $bin "$@" local ret=$? set +x -- cgit v1.2.3