aboutsummaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-01-27 21:10:30 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2013-01-27 21:10:30 +0100
commita4215743db91c4b7050dfda32a670814a101b773 (patch)
tree7466510ff53e0576cfcb2e2433b9300fd0a45901 /lib/common
parent1e4a96730da70fcfa3b8c153874cbdebad0f9829 (diff)
downloadapp.sh-a4215743db91c4b7050dfda32a670814a101b773.tar.gz
app.sh-a4215743db91c4b7050dfda32a670814a101b773.tar.bz2
app.sh-a4215743db91c4b7050dfda32a670814a101b773.tar.xz
app.sh-a4215743db91c4b7050dfda32a670814a101b773.zip
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.
Diffstat (limited to 'lib/common')
-rw-r--r--lib/common34
1 files changed, 19 insertions, 15 deletions
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