aboutsummaryrefslogtreecommitdiff
path: root/.app/lib
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-10-18 13:38:58 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-10-18 13:38:58 +0200
commit83c13f1181c4062ca5296ea956e950064bde0ffe (patch)
treeea021190acabc6e675510e13987cd4addbf50765 /.app/lib
parent993c9a7807e38b365f48334fff6640e07647af03 (diff)
downloadapp.sh-83c13f1181c4062ca5296ea956e950064bde0ffe.tar.gz
app.sh-83c13f1181c4062ca5296ea956e950064bde0ffe.tar.bz2
app.sh-83c13f1181c4062ca5296ea956e950064bde0ffe.tar.xz
app.sh-83c13f1181c4062ca5296ea956e950064bde0ffe.zip
o Making all scripts be run from the root/ directory. Do not assume you're in current/.
Diffstat (limited to '.app/lib')
-rw-r--r--.app/lib/app-instance5
-rw-r--r--.app/lib/app-operate9
-rwxr-xr-x.app/lib/pid-method14
3 files changed, 12 insertions, 16 deletions
diff --git a/.app/lib/app-instance b/.app/lib/app-instance
index 89102b5..5b34bf1 100644
--- a/.app/lib/app-instance
+++ b/.app/lib/app-instance
@@ -191,7 +191,7 @@ method_install() {
echo "Unpacking..."
unzip -q -d $name/$instance/versions/$resolved_version $zip_file
- if [ ! -d $apps/$name/$instance/versions/$resolved_version/root ]
+ if [ ! -d $name/$instance/versions/$resolved_version/root ]
then
echo "Invalid zip file, did not contain a ./root directory." >&2
exit 1
@@ -207,6 +207,7 @@ method_install() {
if [ -x scripts/postinstall ]
then
echo "Running postinstall..."
+ cd root
set +e
env -i \
PATH=/bin:/usr/bin \
@@ -215,7 +216,7 @@ method_install() {
APPSH_NAME=$name \
APPSH_INSTANCE=$instance \
APPSH_VERSION=$resolved_version \
- scripts/postinstall
+ ../scripts/postinstall
set -e
ret=`echo $?`
if [ "$ret" != 0 ]
diff --git a/.app/lib/app-operate b/.app/lib/app-operate
index 45e3da2..83ca100 100644
--- a/.app/lib/app-operate
+++ b/.app/lib/app-operate
@@ -45,6 +45,7 @@ run_control() {
env -i \
PATH=/bin:/usr/bin \
$e \
+ PWD=$PWD \
APPSH_METHOD=$method \
APPSH_APPS=$apps \
APPSH_HOME=$APPSH_HOME \
@@ -56,14 +57,6 @@ run_control() {
set +x
set -e
-# case $ret in
-# 0)
-# echo "Method ${method} completed successfully for $name/$instance"
-# ;;
-# *)
-# echo "Error running method ${method} for $name/$instance"
-# ;;
-# esac
exit $ret
)
}
diff --git a/.app/lib/pid-method b/.app/lib/pid-method
index 55d74b8..29f6b4f 100755
--- a/.app/lib/pid-method
+++ b/.app/lib/pid-method
@@ -2,12 +2,13 @@
set -u
-PID_FILE=$APPSH_APPS/.app/var/pid/$APPSH_NAME-$APPSH_INSTANCE.pid
-
. $APPSH_HOME/.app/lib/app-conf
+pid_file=$APPSH_APPS/.app/var/pid/$APPSH_NAME-$APPSH_INSTANCE.pid
bin=`get_conf $APPSH_APPS $APPSH_NAME $APPSH_INSTANCE app.bin`
+cd $APPSH_APPS/$APPSH_NAME/$APPSH_INSTANCE/current
+
if [ -z "$bin" ]
then
echo "Missing required configuration: app.bin." >&2
@@ -23,9 +24,9 @@ fi
chmod +x "$bin"
PID=
-if [ -r $PID_FILE ]
+if [ -r $pid_file ]
then
- PID="`cat $PID_FILE`"
+ PID="`cat $pid_file`"
fi
do_status() {
@@ -51,9 +52,10 @@ method_start() {
esac
$bin <&- 1<&- 2<&- &
+
PID=$!
echo "Application launched as $PID"
- echo $PID > $PID_FILE
+ echo $PID > $pid_file
return 0
}
@@ -83,7 +85,7 @@ method_stop() {
done
echo " OK"
- rm -f $PID_FILE
+ rm -f $pid_file
return 0
}