diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-10-30 14:29:06 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-10-30 14:29:12 +0100 |
commit | ed52962997364560d341e0197c20a616e9b0f03e (patch) | |
tree | 1a473d954a89ef3d9ea69df19b3650d812a3227e /libexec/app-resolver-maven | |
parent | aab07da2f481f0958c79f0c892c174ab6fd89d63 (diff) | |
download | app.sh-ed52962997364560d341e0197c20a616e9b0f03e.tar.gz app.sh-ed52962997364560d341e0197c20a616e9b0f03e.tar.bz2 app.sh-ed52962997364560d341e0197c20a616e9b0f03e.tar.xz app.sh-ed52962997364560d341e0197c20a616e9b0f03e.zip |
o Supporting platforms where 'xmlstarlet' is installed as 'xml' (At least Suse does that).
Diffstat (limited to 'libexec/app-resolver-maven')
-rwxr-xr-x | libexec/app-resolver-maven | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libexec/app-resolver-maven b/libexec/app-resolver-maven index 419adcc..ec1ad6b 100755 --- a/libexec/app-resolver-maven +++ b/libexec/app-resolver-maven @@ -81,6 +81,44 @@ download_artifact() { fi } + +which() { + /usr/bin/which "$1" 2>/dev/null +} + +# Wrapper to cache the lookup of the xmlstarlet command. +# Remember that xmlstarlet on at least SLES requires single quotes +# instead of double quotes when building the selector, e.g.: +# use [text()='zip'] instead of [text()="zip"]. + +_xmlstarlet="" +xmlstarlet() { + if [ ! -z "$_xmlstarlet" ] + then + "$_xmlstarlet" "$@" + return + fi + + _xmlstarlet="`which xmlstarlet`" + + if [ ! -z "$_xmlstarlet" ] + then + "$_xmlstarlet" "$@" + return + fi + + _xmlstarlet="`which xml`" + + if [ ! -z "$_xmlstarlet" ] + then + "$_xmlstarlet" "$@" + return + fi + + echo "Could not find xmlstarlet." >&2 + exit 1 +} + resolve_version() { local group_id=`app-conf get maven.group_id` local artifact_id=`app-conf get maven.artifact_id` |