aboutsummaryrefslogtreecommitdiffstats
path: root/java/jdk15
diff options
context:
space:
mode:
authorglewis <glewis@FreeBSD.org>2005-11-23 18:12:33 +0800
committerglewis <glewis@FreeBSD.org>2005-11-23 18:12:33 +0800
commit0e3a5a4e890150491b7564225f3562e1d4e16b48 (patch)
treebd78cd9b99ea841d016878b7923e04605f675cde /java/jdk15
parente3e97b51cbfe43cf34444a94d87445b14533d957 (diff)
downloadfreebsd-ports-gnome-0e3a5a4e890150491b7564225f3562e1d4e16b48.tar.gz
freebsd-ports-gnome-0e3a5a4e890150491b7564225f3562e1d4e16b48.tar.zst
freebsd-ports-gnome-0e3a5a4e890150491b7564225f3562e1d4e16b48.zip
. Make pkg-install install a symbolic link for the browser plugin if a
valid one doesn't currently exist. . Add a pkg-deinstall which removes the symbolic link if this port owns it. . Produce pkg-install and pkg-deinstall with SUB_FILES and SUB_LIST rather than manually using ${SED} ourselves. Approved by: maintainer timeout
Diffstat (limited to 'java/jdk15')
-rw-r--r--java/jdk15/Makefile7
-rw-r--r--java/jdk15/files/pkg-deinstall.in31
-rw-r--r--java/jdk15/files/pkg-install.in36
3 files changed, 72 insertions, 2 deletions
diff --git a/java/jdk15/Makefile b/java/jdk15/Makefile
index dbbb3fe1c077..a87e5f7674b1 100644
--- a/java/jdk15/Makefile
+++ b/java/jdk15/Makefile
@@ -48,6 +48,11 @@ MAKE_ENV+= ALT_MOZILLA_HEADERS_PATH="${X11BASE}/include"
.endif
PKGINSTALL= ${WRKDIR}/pkg-install
+PKGDEINSTALL= ${WRKDIR}/pkg-deinstall
+SUB_FILES+= pkg-install \
+ pkg-deinstall
+SUB_LIST+= JRE_HOME=${PREFIX}/jdk${JDK_VERSION}/jre \
+ ARCH=${MACHINE_ARCH}
WRKSRC= ${WRKDIR}/control/make
@@ -301,8 +306,6 @@ do-install:
# XXX: put unregistervm into install script ?
post-install:
@${LOCALBASE}/bin/registervm "${PREFIX}/jdk${JDK_VERSION}/bin/java # FREEBSD-JDK${JDK_VERSION}"
- @${SED} -e "s:%%JRE_HOME%%:${PREFIX}/jdk${JDK_VERSION}/jre:g" \
- < ${FILESDIR}/pkg-install.in > ${PKGINSTALL}
@${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
.include <bsd.port.post.mk>
diff --git a/java/jdk15/files/pkg-deinstall.in b/java/jdk15/files/pkg-deinstall.in
new file mode 100644
index 000000000000..85c89b9d0a51
--- /dev/null
+++ b/java/jdk15/files/pkg-deinstall.in
@@ -0,0 +1,31 @@
+#!/bin/sh
+# $FreeBSD$
+
+# Set up a standard path
+PATH=/usr/bin:/bin
+
+# Don't do anything during post-deinstall
+if [ "$2" = "POST-DEINSTALL" ]; then
+ exit 0
+fi
+
+# Remove the plugin
+
+# Plugin location variables
+BROWSERPLUGINDIR="%%X11BASE%%/lib/browser_plugins"
+JAVAPLUGINDIR="%%JRE_HOME%%/plugin/%%ARCH%%/ns7"
+PLUGIN=libjavaplugin_oji.so
+
+# Check if the package includes the plugin
+if [ ! -e "${JAVAPLUGINDIR}/${PLUGIN}" ]; then
+ exit 0
+fi
+
+# See if the browser plugin is a link to the package plugin and remove it if so.
+if [ -e "${BROWSERPLUGINDIR}/${PLUGIN}" -a \
+ -L "${BROWSERPLUGINDIR}/${PLUGIN}" -a \
+ x`ls -l "${BROWSERPLUGINDIR}/${PLUGIN}" 2>/dev/null | awk '/->/{print $NF;exit 0}END{exit 1}'` = x"${JAVAPLUGINDIR}/${PLUGIN}" ]; then
+ rm -f "${BROWSERPLUGINDIR}/${PLUGIN}"
+fi
+
+exit 0
diff --git a/java/jdk15/files/pkg-install.in b/java/jdk15/files/pkg-install.in
index 6b1b106336c9..0521efe53563 100644
--- a/java/jdk15/files/pkg-install.in
+++ b/java/jdk15/files/pkg-install.in
@@ -17,4 +17,40 @@ if [ "$2" = "POST-INSTALL" ]; then
touch "${JRE_HOME}/.systemPrefs/.systemRootModFile"
chmod 644 "${JRE_HOME}/.systemPrefs/.systemRootModFile"
fi
+
+ # Install the plugin
+ BROWSERPLUGINDIR="%%X11BASE%%/lib/browser_plugins"
+ JAVAPLUGINDIR="${JRE_HOME}/plugin/%%ARCH%%/ns7"
+ PLUGIN=libjavaplugin_oji.so
+
+ # Check if the browser plugin exists
+ if [ ! -e "${JAVAPLUGINDIR}/${PLUGIN}" ]; then
+ exit 0
+ fi
+
+ # Check if the plugin directory exists.
+ if [ ! -d "${BROWSERPLUGINDIR}" ]; then
+ exit 0
+ fi
+
+ # Check if the browser plugin currently exists
+ if [ ! -e "${BROWSERPLUGINDIR}/${PLUGIN}" ]; then
+ # Create symbolic link
+ ln -sf "${JAVAPLUGINDIR}/${PLUGIN}" \
+ "${BROWSERPLUGINDIR}/${PLUGIN}"
+ exit 0
+ fi
+
+ # If the browser plugin exists and is a symlink, but the link
+ # doesn't exist, then overwrite with our plugin.
+ if [ -L "${BROWSERPLUGINDIR}/${PLUGIN}" ]; then
+ # Check if the linked to file exists.
+ if [ ! -e `ls -l "${BROWSERPLUGINDIR}/${PLUGIN}" 2>/dev/null | awk '/->/{print $NF;exit 0}END{exit 1}'` ]; then
+ ln -sf "${JAVAPLUGINDIR}/${PLUGIN}" \
+ "${BROWSERPLUGINDIR}/${PLUGIN}"
+ exit 0
+ fi
+ fi
+
+ exit 0
fi