diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-04-21 11:10:37 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-04-21 14:58:23 +0200 |
commit | 079a49eaaa5a6bacca3181671abd8ebb72015fd1 (patch) | |
tree | fd956e35d17bf41f173d02613c0c31a350291d89 | |
parent | c8a9de50c8f7254c61888982ae270bf71c3f8506 (diff) | |
download | app.sh-079a49eaaa5a6bacca3181671abd8ebb72015fd1.tar.gz app.sh-079a49eaaa5a6bacca3181671abd8ebb72015fd1.tar.bz2 app.sh-079a49eaaa5a6bacca3181671abd8ebb72015fd1.tar.xz app.sh-079a49eaaa5a6bacca3181671abd8ebb72015fd1.zip |
o Allowing the 'app' wrapper to run apps from libexec too.
-rwxr-xr-x | app | 8 | ||||
-rwxr-xr-x | bin/app-conf | 1 | ||||
-rwxr-xr-x | lib/common | 9 | ||||
-rwxr-xr-x | libexec/app-resolver-maven | 1 | ||||
-rwxr-xr-x | libexec/app-run-hook | 10 | ||||
-rwxr-xr-x | libexec/app-set-version | 7 |
6 files changed, 29 insertions, 7 deletions
@@ -53,8 +53,12 @@ bin=`grep_path "/app-$command$" "$APPSH_HOME/bin"` if [ ! -x "$bin" ] then - echo "Unknown command: $command" 2>&1 - exit 1 + bin=`grep_path "/app-$command$" "$APPSH_HOME/libexec"` + if [ ! -x "$bin" ] + then + echo "Unknown command: $command" 2>&1 + exit 1 + fi fi PATH=$APPSH_HOME/bin:$PATH diff --git a/bin/app-conf b/bin/app-conf index 2681f59..fde357f 100755 --- a/bin/app-conf +++ b/bin/app-conf @@ -65,6 +65,7 @@ conf_import() { local dst=$1; shift local src=$1; shift + echo "Importing config from $src" app-cat-conf -f "$src" -f "$dst" > "$dst.tmp" mv "$dst.tmp" "$dst" } @@ -1,5 +1,7 @@ #!/bin/bash +# Asserts that the cwd is an app directory. +# By default it checks that there is a 'current' link. assert_is_app() { local check_link=yes local version= @@ -51,6 +53,8 @@ show_help() { if [ "`declare -f usage_text >/dev/null; echo $?`" = 0 ] then usage_text + else + echo "The command $usage_app does not have any usage info." fi exit 1 } @@ -205,14 +209,15 @@ run_app() { cd "versions/$version" fi + path=/bin:/usr/bin + # This magically get the expansion of $u correct. IFS=" " - # Set a default PATH which can be overridden by the application's settings set +e env -i \ - PATH=/bin:/usr/bin \ + PATH="$PATH" \ $e \ PWD="$PWD" \ APPSH_HOME="$APPSH_HOME" \ diff --git a/libexec/app-resolver-maven b/libexec/app-resolver-maven index 7f01992..118223a 100755 --- a/libexec/app-resolver-maven +++ b/libexec/app-resolver-maven @@ -175,6 +175,7 @@ download_version() { echo "Downloading $group_id:$artifact_id:$resolved_version..." get $r $l + rm -f "$target" ln -s "`pwd`/$l" "$target" } diff --git a/libexec/app-run-hook b/libexec/app-run-hook index f1b2457..9322fe4 100755 --- a/libexec/app-run-hook +++ b/libexec/app-run-hook @@ -43,7 +43,13 @@ then exit 0 fi -# TODO: remove after -#chmod +x $bin +chmod +x $bin + +if [[ ! -e $bin ]] +then + info "Not executable: $bin" + exit 0 +fi + debug "Running hook: $hook" run_app -v $version hooks/$hook diff --git a/libexec/app-set-version b/libexec/app-set-version index 4c8e797..0abb9b8 100755 --- a/libexec/app-set-version +++ b/libexec/app-set-version @@ -8,6 +8,10 @@ APPSH_HOME=$(cd $(dirname "$0")/.. && pwd) . $APPSH_HOME/lib/common # HEADER END +usage_text() { + echo "usage: $usage_app -v <version>" +} + version= while getopts "v:" opt @@ -43,7 +47,8 @@ then prev=${prev:1} prev=${prev/%?root} echo "Changing current symlink from $prev to $version" - ln -f -s versions/$version/root current + rm current + ln -s versions/$version/root current else echo "Creating current symlink for version $version" ln -s versions/$version/root current |