aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-10-30 14:29:06 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2013-10-30 14:29:12 +0100
commited52962997364560d341e0197c20a616e9b0f03e (patch)
tree1a473d954a89ef3d9ea69df19b3650d812a3227e
parentaab07da2f481f0958c79f0c892c174ab6fd89d63 (diff)
downloadapp.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).
-rwxr-xr-xlibexec/app-resolver-maven38
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`