From 969c6fea9f5f68f34bd268e5783dcb8267b13e03 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 14 May 2013 21:33:45 -0400 Subject: jh-mvn-install: optionally create a symlink in /usr/share/java --- jh-mvn-install.help.txt | 10 ++++++++-- jh-mvn-install.sh | 9 ++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/jh-mvn-install.help.txt b/jh-mvn-install.help.txt index 838630f..faf80b8 100644 --- a/jh-mvn-install.help.txt +++ b/jh-mvn-install.help.txt @@ -1,8 +1,14 @@ -Usage: @cmd@ mvn-install +Usage: @cmd@ mvn-install [] Installs an artifact into the local Maven 2 repository. +Optionally creates a 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 + /path/to/junit-dep.jar /path/to/junit-dep.pom 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/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 b135d8f..ab67594 100644 --- a/jh-mvn-install.sh +++ b/jh-mvn-install.sh @@ -4,7 +4,7 @@ # 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 ]]; then +if [[ $# != 5 ]] && [[ $# != 6 ]]; then jh-help $0 >>/dev/stderr exit 1 fi @@ -12,8 +12,15 @@ fi base=`jh-mvn-basename $1 $2 $3` jarfile=$4 pomfile=$5 +alias=$6 dir="${base%/*}" install -d "${DESTDIR}${dir}" install -m 644 "$jarfile" "${DESTDIR}${base}.jar" install -m 644 "$pomfile" "${DESTDIR}${base}.pom" + +if [[ -n $alias ]]; then + link="/usr/share/java/$alias" + install -d "${DESTDIR}${link%/*}" + ln -s "${base}.jar" "${DESTDIR}${link}" +fi -- cgit v1.2.3-54-g00ecf