
#!/bin/sh
#
######################################################################################
# This script re-packages the Oracle Embedded JRE for ARM and makes it
# an installable Slackware package.  Slackware cannot distribute the binary
# though because the licence does not permit it.
# 
# Oracle provide an evaluation binary version from the web site:
#
#  http://www.oracle.com/technetwork/java/javase/downloads/embedded-jsp-135769.html
#
#  Choose: "ARMv5 Linux - Headless: EABI, Soft Float, Little Endian"
#
# Steps to build package:
# 1. Download the binary archive from the web site above (after registering with Oracle)
# 2. Drop the binary into this source directory.
# 3. Update the ''VERSION='' number in this script, if necessary.
# 4. Run this script.
# 5. The Slackware package will be created in /tmp
######################################################################################
#
# Copyright 2010  Stuart Winter, Surrey, England, UK.
# 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.
######################################################################################

PKGNAM=ejre
VERSION=1.6.0_10
BUILD=${BUILD:-1}
ARCH=arm

CWD=$(pwd)
PKG=/tmp/package-$PKGNAM
rm -rf $PKG

# Create package framework:
mkdir -vpm755 $PKG/{install,usr/lib,etc/profile.d}

# "Install"
cd $PKG/usr/lib
#tar xvvf $CWD/$PKGNAM*tar.* || exit 1
# I have a copy in my own source directory but I can't ship it:
tar xvvf $CWD/EXCLUDE/$PKGNAM*tar.* || exit 1
mv -fv ejre* java || exit 1

# Sort out permissions:
chown -R root:root .
chmod -R og-w .
#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 {} \;

# Install profile scripts:
install -vpm755 $CWD/profile.d/* $PKG/etc/profile.d/

# Copy package description:
#zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
install -vpm644 $CWD/slack-desc $PKG/install/

# Build package:
cd $PKG
/sbin/makepkg -l y -c n /tmp/$PKGNAM-$VERSION-$ARCH-$BUILD.txz

#EOF
