# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../oc4j/oc4j.conf
# Copyright (C) 2006 - 2008 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---


# Oracle Container for Java depends on a java runtime environment.
# Since we do not care to much which one, we just check for the java
# directory tree being around.
pkgprefix -t java-dirtree
prefix=opt/$pkg
set_confopt

# Prevent executing normal make and install build steps.
# This package has custom make and install.
makeopt=
makeinstopt=

# Make sure zip extraction ends up extracting all files into a
# special directory ($pgk-$ver). This is necessary since the
# zip archive does itself not have a common root dir.
var_append zipopt ' ' -d$pkg-$ver

# Custom installation.
oc4j_postmake() {
        # Copy the extracted archive to the current prefix location.
        # But make sure to preserve any possible links.
        tar -c * | tar -x -C /$prefix

	# Make sure we end up using the proper environment. For
	# we set the required env var in profile.d
	cat <<-EOT > $root/etc/profile.d/$pkg
	ORACLE_HOME=/$prefix
	export ORACLE_HOME
	EOT
}

hook_add postmake 5 oc4j_postmake