aboutsummaryrefslogtreecommitdiff
path: root/.app/lib
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-10-17 22:20:46 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-10-17 22:20:46 +0200
commit993c9a7807e38b365f48334fff6640e07647af03 (patch)
tree4347844f2039b29f134e4f729ce38180ad047f8c /.app/lib
parentfbc6c0b93a88ac10730dd6f4492750cd32e2b44a (diff)
downloadapp.sh-993c9a7807e38b365f48334fff6640e07647af03.tar.gz
app.sh-993c9a7807e38b365f48334fff6640e07647af03.tar.bz2
app.sh-993c9a7807e38b365f48334fff6640e07647af03.tar.xz
app.sh-993c9a7807e38b365f48334fff6640e07647af03.zip
o Renaming BASEDIR to apps, APPSH_BASEDIR to APPSH_APPS.
Diffstat (limited to '.app/lib')
-rw-r--r--.app/lib/app-common10
-rw-r--r--.app/lib/app-conf28
-rw-r--r--.app/lib/app-instance28
-rw-r--r--.app/lib/app-operate6
-rwxr-xr-x.app/lib/pid-method4
5 files changed, 38 insertions, 38 deletions
diff --git a/.app/lib/app-common b/.app/lib/app-common
index 584e053..ade49c7 100644
--- a/.app/lib/app-common
+++ b/.app/lib/app-common
@@ -37,7 +37,7 @@ list_apps() {
filter_instnace=$1; shift
vars="$@"
- sort $BASEDIR/.app/var/list | while read line
+ sort $apps/.app/var/list | while read line
do
echo $line | (IFS=:; while read name instance version junk
do
@@ -78,13 +78,13 @@ find_current_version() {
name=$1
instance=$2
- if [ ! -L $BASEDIR/$name/$instance/current ]
+ if [ ! -L $apps/$name/$instance/current ]
then
return 0
fi
(
- cd $BASEDIR/$name/$instance
+ cd $apps/$name/$instance
ls -l current | sed -n "s,.* current -> versions/\(.*\)/root,\1,p"
)
}
@@ -93,13 +93,13 @@ find_versions() {
name=$1
instance=$2
- if [ ! -d $BASEDIR/$name/$instance/versions ]
+ if [ ! -d $apps/$name/$instance/versions ]
then
return 0
fi
(
- cd $BASEDIR/$name/$instance/versions
+ cd $apps/$name/$instance/versions
ls -1d *
)
}
diff --git a/.app/lib/app-conf b/.app/lib/app-conf
index c9204e9..4cf4b7f 100644
--- a/.app/lib/app-conf
+++ b/.app/lib/app-conf
@@ -15,12 +15,12 @@ format_conf() {
}
get_conf() {
- local BASEDIR=$1
+ local apps=$1
local name=$2
local instance=$3
local key=$4
local default=
- local file=$BASEDIR/$name/$instance/current/etc/app.conf
+ local file=$apps/$name/$instance/current/etc/app.conf
shift 4
@@ -47,10 +47,10 @@ get_conf() {
}
get_conf_all() {
- local BASEDIR=$1
+ local apps=$1
local name=$2
local instance=$3
- local file=$BASEDIR/$name/$instance/current/etc/app.conf
+ local file=$apps/$name/$instance/current/etc/app.conf
if [ ! -r "$file" ]
then
@@ -61,12 +61,12 @@ get_conf_all() {
}
get_conf_in_group() {
- local BASEDIR=$1
+ local apps=$1
local name=$2
local instance=$3
local group=$4
- get_conf_all "$BASEDIR" "$name" "$instance" | sed -n "s,^${group}\.\(.*\),\1,p"
+ get_conf_all "$apps" "$name" "$instance" | sed -n "s,^${group}\.\(.*\),\1,p"
}
assert_key() {
@@ -81,13 +81,13 @@ assert_key() {
}
conf_set() {
- local BASEDIR=$1
+ local apps=$1
local name=$2
local instance=$3
local key=$4
local value=$5
- local file=$BASEDIR/$name/$instance/current/etc/app.conf
+ local file=$apps/$name/$instance/current/etc/app.conf
assert_key "$key"
@@ -101,12 +101,12 @@ conf_set() {
}
conf_delete() {
- local BASEDIR=$1
+ local apps=$1
local name=$2
local instance=$3
local key=$4
- local file=$BASEDIR/$name/$instance/current/etc/app.conf
+ local file=$apps/$name/$instance/current/etc/app.conf
assert_key "$key"
@@ -118,7 +118,7 @@ method_conf_list() {
local name=$1; shift
local instance=$1; shift
- get_conf_all "$BASEDIR" "$name" "$instance" | format_conf
+ get_conf_all "$apps" "$name" "$instance" | format_conf
}
method_conf_usage() {
@@ -166,7 +166,7 @@ method_conf() {
exit 1
fi
- get_conf_in_group "$BASEDIR" "$name" "$instance" "$1" | format_conf
+ get_conf_in_group "$apps" "$name" "$instance" "$1" | format_conf
;;
set)
if [ $# -ne 2 ]
@@ -175,7 +175,7 @@ method_conf() {
exit 1
fi
- conf_set "$BASEDIR" "$name" "$instance" "$1" "$2"
+ conf_set "$apps" "$name" "$instance" "$1" "$2"
;;
delete)
if [ $# -ne 1 ]
@@ -184,7 +184,7 @@ method_conf() {
exit 1
fi
- conf_delete "$BASEDIR" "$name" "$instance" "$1"
+ conf_delete "$apps" "$name" "$instance" "$1"
;;
*)
if [ $# -eq 0 ]
diff --git a/.app/lib/app-instance b/.app/lib/app-instance
index 5c452d2..89102b5 100644
--- a/.app/lib/app-instance
+++ b/.app/lib/app-instance
@@ -32,7 +32,7 @@ resolve_snapshot() {
local zip_file=$1
echo "Resolving version $version..."
- metadata=$BASEDIR/.app/var/download/$groupId-$artifactId-$version-metadata.xml
+ metadata=$apps/.app/var/download/$groupId-$artifactId-$version-metadata.xml
base_url=$repo/$(echo $groupId | sed "s,\.,/,g")/$artifactId/$version
get $base_url/maven-metadata.xml $metadata
resolved_version=`xmlstarlet sel -t -m '//snapshotVersion[extension[text()="zip"]]' -v value $metadata`
@@ -147,7 +147,7 @@ method_install() {
resolve_snapshot
- zip_file=$BASEDIR/.app/var/download/$groupId-$artifactId-$resolved_version.zip
+ zip_file=$apps/.app/var/download/$groupId-$artifactId-$resolved_version.zip
download_artifact $zip_file
;;
@@ -191,7 +191,7 @@ method_install() {
echo "Unpacking..."
unzip -q -d $name/$instance/versions/$resolved_version $zip_file
- if [ ! -d $BASEDIR/$name/$instance/versions/$resolved_version/root ]
+ if [ ! -d $apps/$name/$instance/versions/$resolved_version/root ]
then
echo "Invalid zip file, did not contain a ./root directory." >&2
exit 1
@@ -210,7 +210,7 @@ method_install() {
set +e
env -i \
PATH=/bin:/usr/bin \
- APPSH_BASEDIR=$BASEDIR \
+ APPSH_APPS=$apps \
APPSH_HOME=$APPSH_HOME \
APPSH_NAME=$name \
APPSH_INSTANCE=$instance \
@@ -228,8 +228,8 @@ method_install() {
)
echo "Changing current symlink"
- rm -f $BASEDIR/$name/$instance/current
- ln -s versions/$resolved_version/root $BASEDIR/$name/$instance/current
+ rm -f $apps/$name/$instance/current
+ ln -s versions/$resolved_version/root $apps/$name/$instance/current
if [ -d $name/$instance/current/bin ]
then
@@ -239,12 +239,12 @@ method_install() {
)
fi
- if [ -r $BASEDIR/.app/var/list ]
+ if [ -r $apps/.app/var/list ]
then
- sed "/^$name:$instance/d" $BASEDIR/.app/var/list > $BASEDIR/.app/var/list.new
+ sed "/^$name:$instance/d" $apps/.app/var/list > $apps/.app/var/list.new
fi
- echo "$name:$instance:$version:$url" >> $BASEDIR/.app/var/list.new
- mv $BASEDIR/.app/var/list.new $BASEDIR/.app/var/list
+ echo "$name:$instance:$version:$url" >> $apps/.app/var/list.new
+ mv $apps/.app/var/list.new $apps/.app/var/list
}
method_set_current_usage() {
@@ -293,14 +293,14 @@ method_set_current() {
assert_is_instance method_set_current_usage "$name" "$instance" "no"
- if [ ! -d $BASEDIR/$name/$instance/versions/$version ]
+ if [ ! -d $apps/$name/$instance/versions/$version ]
then
echo "Invalid version: $version."
exit 1
fi
- rm -f $BASEDIR/$name/$instance/current
- ln -s versions/$version/root $BASEDIR/$name/$instance/current
+ rm -f $apps/$name/$instance/current
+ ln -s versions/$version/root $apps/$name/$instance/current
return 0
}
@@ -347,7 +347,7 @@ method_list() {
esac
done
- if [ ! -r $BASEDIR/.app/var/list ]
+ if [ ! -r $apps/.app/var/list ]
then
return
fi
diff --git a/.app/lib/app-operate b/.app/lib/app-operate
index e28df96..45e3da2 100644
--- a/.app/lib/app-operate
+++ b/.app/lib/app-operate
@@ -25,7 +25,7 @@ run_control() {
APPSH_INSTANCE_HOME=`pwd`
cd current
- bin=`get_conf $BASEDIR $name $instance app.method`
+ bin=`get_conf $apps $name $instance app.method`
if [ -z "$bin" ]
then
@@ -38,7 +38,7 @@ run_control() {
exit 1
fi
- e="`get_conf_in_group $BASEDIR $name $instance env`"
+ e="`get_conf_in_group $apps $name $instance env`"
# Set a default PATH which can be overridden by the application's settings
set +e
@@ -46,7 +46,7 @@ run_control() {
PATH=/bin:/usr/bin \
$e \
APPSH_METHOD=$method \
- APPSH_BASEDIR=$BASEDIR \
+ APPSH_APPS=$apps \
APPSH_HOME=$APPSH_HOME \
APPSH_NAME=$name \
APPSH_INSTANCE=$instance \
diff --git a/.app/lib/pid-method b/.app/lib/pid-method
index a3e9cff..55d74b8 100755
--- a/.app/lib/pid-method
+++ b/.app/lib/pid-method
@@ -2,11 +2,11 @@
set -u
-PID_FILE=$APPSH_BASEDIR/.app/var/pid/$APPSH_NAME-$APPSH_INSTANCE.pid
+PID_FILE=$APPSH_APPS/.app/var/pid/$APPSH_NAME-$APPSH_INSTANCE.pid
. $APPSH_HOME/.app/lib/app-conf
-bin=`get_conf $APPSH_BASEDIR $APPSH_NAME $APPSH_INSTANCE app.bin`
+bin=`get_conf $APPSH_APPS $APPSH_NAME $APPSH_INSTANCE app.bin`
if [ -z "$bin" ]
then