aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorglewis <glewis@FreeBSD.org>2005-11-25 11:39:42 +0800
committerglewis <glewis@FreeBSD.org>2005-11-25 11:39:42 +0800
commitf0271690812a22e51afe122057dd64999d4a513a (patch)
treeaeaf270f7d096bb3db66c95411abbdd6ea4a556e /java
parent529b5a1099a012708eee1967c96668dd09e16834 (diff)
downloadfreebsd-ports-gnome-f0271690812a22e51afe122057dd64999d4a513a.tar.gz
freebsd-ports-gnome-f0271690812a22e51afe122057dd64999d4a513a.tar.zst
freebsd-ports-gnome-f0271690812a22e51afe122057dd64999d4a513a.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')
-rw-r--r--java/jdk14/Makefile7
-rw-r--r--java/jdk14/files/pkg-deinstall.in31
-rw-r--r--java/jdk14/files/pkg-install.in58
3 files changed, 84 insertions, 12 deletions
diff --git a/java/jdk14/Makefile b/java/jdk14/Makefile
index 9de98735414e..590e853377b8 100644
--- a/java/jdk14/Makefile
+++ b/java/jdk14/Makefile
@@ -35,6 +35,11 @@ BUILD_DEPENDS+= ${X11BASE}/lib/libXm.so:${PORTSDIR}/x11-toolkits/open-motif
.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
@@ -335,8 +340,6 @@ post-install:
${FIND} "${PREFIX}/jdk${JDK_VERSION}/jre/plugin" -type d | ${XARGS} ${CHMOD} a+rx
.endif
@${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/jdk14/files/pkg-deinstall.in b/java/jdk14/files/pkg-deinstall.in
new file mode 100644
index 000000000000..54724931d7b1
--- /dev/null
+++ b/java/jdk14/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%%/ns610"
+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/jdk14/files/pkg-install.in b/java/jdk14/files/pkg-install.in
index fa980a9778f0..53fd8ef1b97c 100644
--- a/java/jdk14/files/pkg-install.in
+++ b/java/jdk14/files/pkg-install.in
@@ -1,19 +1,57 @@
#!/bin/sh
+# $FreeBSD$
# System preference location
-PREFS_LOCATION=%%JRE_HOME%%
+JRE_HOME=%%JRE_HOME%%
-# Set up system preferences during post install
+# Post-install actions
if [ "$2" = "POST-INSTALL" ]; then
- if [ ! -d "${PREFS_LOCATION}/.systemPrefs" ] ; then
- mkdir -m 755 "${PREFS_LOCATION}/.systemPrefs"
+ # Set up system preferences
+ if [ ! -d "${JRE_HOME}/.systemPrefs" ] ; then
+ mkdir -m 755 "${JRE_HOME}/.systemPrefs"
fi
- if [ ! -f "${PREFS_LOCATION}/.systemPrefs/.system.lock" ] ; then
- touch "${PREFS_LOCATION}/.systemPrefs/.system.lock"
- chmod 644 "${PREFS_LOCATION}/.systemPrefs/.system.lock"
+ if [ ! -f "${JRE_HOME}/.systemPrefs/.system.lock" ] ; then
+ touch "${JRE_HOME}/.systemPrefs/.system.lock"
+ chmod 644 "${JRE_HOME}/.systemPrefs/.system.lock"
fi
- if [ ! -f "${PREFS_LOCATION}/.systemPrefs/.systemRootModFile" ] ; then
- touch "${PREFS_LOCATION}/.systemPrefs/.systemRootModFile"
- chmod 644 "${PREFS_LOCATION}/.systemPrefs/.systemRootModFile"
+ if [ ! -f "${JRE_HOME}/.systemPrefs/.systemRootModFile" ] ; 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%%/ns610"
+ 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