#!/bin/sh # Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Note that the slack-desc file mentions the JRE version (edit when upgrading)! VERSION=6u20 DVER=1.6.0_20 ARCH=i586 BUILD=${BUILD:-1} # As of jre-6u12 a 64bit plugin is available. # SUN says: # Please note that the 64-bit JRE only works with the 64-bit browser plug-in, # while the 32-bit JRE only works with 32-bit browser plug-in. # If you use both 32-bit and 64-bit browsers interchangeably, you will need to # have both 32-bit and 64-bit JRE's installed on your machine. JAVA_ARCH=${JAVA_ARCH:-i586} # or i586 if you want the 32bit version if [ "$JAVA_ARCH" = "x64" ]; then LIB_ARCH=amd64 else LIB_ARCH=i386 fi if [ "$ARCH" = "x86_64" ]; then LIBDIRSUFFIX="64" else LIBDIRSUFFIX="" fi CWD=$(pwd) TMP=${TMP:-/tmp} PKG=$TMP/package-jre rm -rf $PKG mkdir -p $TMP $PKG cd $PKG mkdir -p usr/lib${LIBDIRSUFFIX} cd usr/lib${LIBDIRSUFFIX} yes yes | sh $( ls --indicator-style none $CWD/jre-${VERSION}-linux-${JAVA_ARCH}*.bin | tail -1) || exit 1 mkdir -p $PKG/etc/profile.d for file in $(ls $CWD/profile.d/*) ; do cat $file | sed -e "s#lib/java#lib${LIBDIRSUFFIX}/java#" \ > $PKG/etc/profile.d/$(basename $file) done chown -R root:root $PKG ( cd $PKG find . \ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ -exec chmod 755 {} \; -o \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; ) chmod 755 $PKG/etc/profile.d/* ( cd $PKG/usr/lib${LIBDIRSUFFIX} mv jre${DVER} java || exit 1 ln -sf java jre${DVER} ) || exit 1 mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/mozilla/plugins ( cd $PKG/usr/lib${LIBDIRSUFFIX}/mozilla/plugins ln -sf /usr/lib${LIBDIRSUFFIX}/java/lib/${LIB_ARCH}/libnpjp2.so libnpjp2.so ) ( cd $PKG/usr/lib${LIBDIRSUFFIX} ln -sf ./java/lib/${LIB_ARCH}/server/libjvm.so . ) mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat << EOF > $PKG/install/doinst.sh # Clean up a potential upgrade mess caused by changing the # installation directory to /usr/lib${LIBDIRSUFFIX}/java/: if [ -L usr/lib${LIBDIRSUFFIX}/java ]; then rm -rf usr/lib${LIBDIRSUFFIX}/java mkdir -p usr/lib${LIBDIRSUFFIX}/java/man mkdir -p usr/lib${LIBDIRSUFFIX}/java/lib/${LIB_ARCH}/server mkdir -p usr/lib/java/lib${LIBDIRSUFFIX}/${LIB_ARCH}/client mkdir -p usr/lib${LIBDIRSUFFIX}/java/javaws mkdir -p usr/lib${LIBDIRSUFFIX}/java/bin mkdir -p usr/lib${LIBDIRSUFFIX}/mozilla/plugins fi if [ -L ControlPanel ]; then rm -f ControlPanel fi if [ -L ja ]; then rm -f ja fi if [ -L javaws ]; then rm -f javaws fi if [ -L libjsig.so ]; then rm -f libjsig.so fi # End cleanup. EOF # Install the desktop/mime files: mkdir -p $PKG/usr/share/{applications,icons,mime} cp -a $PKG/usr/lib${LIBDIRSUFFIX}/java/lib/desktop/applications/* \ $PKG/usr/share/applications/ cp -a $PKG/usr/lib${LIBDIRSUFFIX}/java/lib/desktop/icons/hicolor \ $PKG/usr/share/icons/ cp -a $PKG/usr/lib${LIBDIRSUFFIX}/java/lib/desktop/mime/packages \ $PKG/usr/share/mime/ # We ship the package unmodified, so we do not compress manpages. cd $PKG /sbin/makepkg -l y -c n $TMP/jre-$(echo $VERSION | tr - _)-${ARCH}-$BUILD.txz