summaryrefslogtreecommitdiffstats
path: root/bin/dojar
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-08-28 08:37:44 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-08-28 08:37:44 +0000
commitd9fc4acc572c6647a4f27b838d35d27d805d190e (patch)
tree262a8de35d8c7567312757da5f1f66efdc8cece5 /bin/dojar
downloadportage-d9fc4acc572c6647a4f27b838d35d27d805d190e.tar.gz
portage-d9fc4acc572c6647a4f27b838d35d27d805d190e.tar.bz2
portage-d9fc4acc572c6647a4f27b838d35d27d805d190e.zip
Migration (without history) of the current stable line to subversion.
svn path=/main/branches/2.0/; revision=1941
Diffstat (limited to 'bin/dojar')
-rwxr-xr-xbin/dojar54
1 files changed, 54 insertions, 0 deletions
diff --git a/bin/dojar b/bin/dojar
new file mode 100755
index 000000000..77dadfee0
--- /dev/null
+++ b/bin/dojar
@@ -0,0 +1,54 @@
+#!/bin/sh
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-src/portage/bin/dojar,v 1.8 2004/10/04 13:56:50 vapier Exp $
+# Author Karl Trygve Kalleberg <karltk@gentoo.org>
+
+#
+# Typical usage:
+# dojar foo.jar bar.jar
+# - installs foo.jar and bar.jar into /usr/share/${PN}/lib, and adds them
+# both to /usr/share/${PN}/classpath.env
+#
+# Detailed usage
+# dojar <list-of-jars>
+# - installs <list-of-jars> into /usr/share/${PN}/lib and adds each to
+# /usr/share/${PN}/classpath.env.
+#
+# The classpath.env file is currently merely a convenience for the user as
+# it allows him to:
+# export CLASSPATH=${CLASSPATH}:`cat /usr/share/foo/classpath.env`
+#
+# For many packages that set FOO_HOME, placing the jar files into
+# lib will allow the user to set FOO_HOME=/usr/share/foo and have the
+# scripts work as expected.
+#
+# Possibly a jarinto will be needed in the future.
+#
+
+if [ -z "$JARDESTTREE" ] ; then
+ JARDESTTREE="lib"
+fi
+
+jarroot="${DESTTREE}/share/${PN}/"
+jardest="${DESTTREE}/share/${PN}/${JARDESTTREE}/"
+pf="${D}${jarroot}/package.env"
+
+dodir "${jardest}"
+
+for i in $* ; do
+ bn="$(basename $i)"
+
+ if [ -f "$pf" ] ; then
+ oldcp=`grep "CLASSPATH=" "$pf" | sed "s/CLASSPATH=//"`
+ grep -v "CLASSPATH=" "$pf" > "${pf}.new"
+ echo "CLASSPATH=${oldcp}:${jardest}${bn}" >> "${pf}.new"
+ mv "${pf}.new" "$pf"
+ else
+ echo "DESCRIPTION=\"${DESCRIPTION}\"" > "$pf"
+ echo "CLASSPATH=${jardest}${bn}" >> "$pf"
+ fi
+
+ cp "$i" "${D}${jardest}/"
+ chmod 0444 "${D}${jardest}/${bn}"
+done