diff options
Diffstat (limited to 'libexec')
| -rwxr-xr-x | libexec/app-operator-pid | 2 | ||||
| -rwxr-xr-x | libexec/app-resolver-file | 94 | ||||
| -rwxr-xr-x | libexec/app-resolver-maven | 2 | 
3 files changed, 96 insertions, 2 deletions
| diff --git a/libexec/app-operator-pid b/libexec/app-operator-pid index 6aedb03..dd48979 100755 --- a/libexec/app-operator-pid +++ b/libexec/app-operator-pid @@ -1,4 +1,4 @@ -#!/bin/bash -e +#!/bin/bash  set -e  set -u diff --git a/libexec/app-resolver-file b/libexec/app-resolver-file new file mode 100755 index 0000000..6282b83 --- /dev/null +++ b/libexec/app-resolver-file @@ -0,0 +1,94 @@ +#!/bin/bash + +set -e +set -u + +APPSH_HOME=$(cd $(dirname "$0")/.. && pwd) + +. $APPSH_HOME/lib/common +# HEADER END + +usage_text() { +  echo "usage: $usage_app init <file>" +  echo "usage: $usage_app resolve-version" +  echo "usage: $usage_app download-version -v <version> -f <download target>" +} + +init() { +  while getopts "r:" opt +  do +    case $opt in +      r) +        app-conf set maven.repo "$OPTARG" +        shift 2 +        OPTIND=1 +        ;; +      *) +        usage "Invalid option: $OPTARG"  +        ;; +    esac +  done + +  local file=${1-} + +  if [[ ! -r "$file" ]] +  then +    fatal "Can't read file: $file" +  fi + +  app-conf set file.path "$file" +} + +resolve_version() { +  path=$(app-conf get file.path) + +  local s=$(stat -c %Z $path) + +  app-conf set app.version "$s" +} + +download_version() { +  target="" +  while getopts "v:f:" opt +  do +    case $opt in +      v) +        # Ignored +        ;; +      f) +        target="$OPTARG" +        ;; +      *) +        usage "Invalid option: $OPTARG"  +        ;; +    esac +  done + +  if [[ $target == "" ]] +  then +    usage +  fi + +  path=$(app-conf get file.path) + +  ln -s "$path" "$target" +} + +command="$1"; shift + +case "$command" in +  init) +    init "$@" +    ;; +  resolve-version) +    resolve_version +    ;; +  download-version) +    download_version "$@" +    ;; +  *) +    usage +    ;; +esac + +exit 0 diff --git a/libexec/app-resolver-maven b/libexec/app-resolver-maven index 8394ee1..deb1e7a 100755 --- a/libexec/app-resolver-maven +++ b/libexec/app-resolver-maven @@ -200,7 +200,7 @@ init() {    if [[ $# != 3 || $1 == "" || $2 == "" || $3 == "" ]]    then -    usage "Invalid Maven coordinates: $coordinates" +    fatal "Invalid Maven coordinates: $coordinates"    fi    group_id=$1 | 
