summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-05-16 11:05:37 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-05-16 11:05:37 -0400
commitcc19a12999e4cc7ce5f09426f5916a19021f49bc (patch)
tree5db1ec14c71ae37c5eacce980aafeb303d0dbd99
parent969c6fea9f5f68f34bd268e5783dcb8267b13e03 (diff)
jh-mvn-install: switch 4th & 5th arguments to make jarfile optional
This of course, breaks compatibility with every program that uses it.
-rw-r--r--jh-mvn-install.help.txt8
-rw-r--r--jh-mvn-install.sh25
2 files changed, 19 insertions, 14 deletions
diff --git a/jh-mvn-install.help.txt b/jh-mvn-install.help.txt
index faf80b8..2cb2ef6 100644
--- a/jh-mvn-install.help.txt
+++ b/jh-mvn-install.help.txt
@@ -1,14 +1,14 @@
-Usage: @cmd@ mvn-install <groupId> <artifactId> <version> <jar-file> <pom-file> [<alias.jar>]
+Usage: @cmd@ mvn-install <groupId> <artifactId> <version> <pom-file> [<jar-file>] [<alias.jar>...]
Installs an artifact into the local Maven 2 repository.
-Optionally creates a symlink in `/usr/share/java`.
+Optionally creates an alias (symlink) in `/usr/share/java`.
This command obeys the DESTDIR environmental variable.
Example:
$ @cmd@ mvn-install junit junit-dep 4.10 \
- /path/to/junit-dep.jar /path/to/junit-dep.pom junit.jar
+ /path/to/junit-dep.pom /path/to/junit-dep.jar junit.jar
Would install the files
- ${DESTDIR}/usr/share/maven/junit/junit-dep/4.10/junit-dep-4.10.jar
${DESTDIR}/usr/share/maven/junit/junit-dep/4.10/junit-dep-4.10.pom
+ ${DESTDIR}/usr/share/maven/junit/junit-dep/4.10/junit-dep-4.10.jar
${DESTDIR}/usr/share/java/junit.jar -> /usr/share/maven/junit/junit-dep/4.10/junit-dep-4.10.jar
diff --git a/jh-mvn-install.sh b/jh-mvn-install.sh
index ab67594..e3db6ad 100644
--- a/jh-mvn-install.sh
+++ b/jh-mvn-install.sh
@@ -4,23 +4,28 @@
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See the COPYING file for more details.
-if [[ $# != 5 ]] && [[ $# != 6 ]]; then
+if [[ $# < 4 ]]; then
jh-help $0 >>/dev/stderr
exit 1
fi
base=`jh-mvn-basename $1 $2 $3`
-jarfile=$4
-pomfile=$5
-alias=$6
+pomfile=$4
+jarfile=$5
+if shift 5; then
+ aliases=("$@")
+fi
dir="${base%/*}"
install -d "${DESTDIR}${dir}"
-install -m 644 "$jarfile" "${DESTDIR}${base}.jar"
-install -m 644 "$pomfile" "${DESTDIR}${base}.pom"
+install -m 644 "$jarfile" "${DESTDIR}${base}.pom"
+[[ -n $jarfile ]] || exit 0
+install -m 644 "$pomfile" "${DESTDIR}${base}.jar"
-if [[ -n $alias ]]; then
- link="/usr/share/java/$alias"
- install -d "${DESTDIR}${link%/*}"
- ln -s "${base}.jar" "${DESTDIR}${link}"
+if [[ -n "${aliases[*]}" ]]; then
+ for alias in "${aliases[@]}"; do
+ link="/usr/share/java/$alias"
+ install -d "${DESTDIR}${link%/*}"
+ ln -s "${base}.jar" "${DESTDIR}${link}"
+ done
fi