summaryrefslogtreecommitdiff
blob: 868fcfd6b44838da54c459efe9e509ce0030ee8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/java.eclass,v 1.16 2004/05/11 13:02:05 vapier Exp $
#
# Author: Karl Trygve Kalleberg <karltk@gentoo.org>

ECLASS=java
INHERITED="$INHERITED $ECLASS"
DESCRIPTION="Based on the $ECLASS eclass"

VMHANDLE=${PN}-${PV}

function sed2() {
	unset filename 
	unset arglist
	local filename=""
	local arglist
	declare -a arglist
	while test $# -gt 0 ; do
		case $1 in
			-e)
				shift
				arglist[${#arglist[@]}]="-e"
				arglist[${#arglist[@]}]="$1"
			;;
			*)
				if [ -e "$1" ] ; then 
					filename=$1
				fi
			;;
		esac
		shift
	done

	if [ ! -z $filename ] ; then 
		mv "${filename}" "${filename}.orig"
		sed "${arglist[@]}" < ${filename}.orig > ${filename}
		return 0
	else
		return 1
	fi
}

java_pkg_postinst() {
#	if [ -z `java-config --java 2> /dev/null` ] ; then 
#		einfo "No default VM found, setting ${VMHANDLE} as default"
		einfo "Setting ${VMHANDLE} as default"
		einfo "Use java-config to reassign your VM."
		java-config --set-system-vm=${VMHANDLE}
		/usr/sbin/env-update
		source /etc/profile
#	fi
}

pkg_postinst() {
	java_pkg_postinst
}

system_arch() {
	local sarch
	sarch=`echo $ARCH | sed -e s/[i]*.86/i386/ -e s/x86_64/amd64/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/`
	if [ -z "$sarch" ] ; then
		sarch=`uname -m | sed -e s/[i]*.86/i386/ -e s/x86_64/amd64/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/`
	fi
	echo $sarch
}

set_java_env() {
	dodir /etc/env.d/java
	platform=`system_arch`
	
	sed \
		-e "s/@P@/${P}/g" \
		-e "s/@PN@/${PN}/g" \
		-e "s/@PV@/${PV}/g" \
		-e "s/@PF@/${PF}/g" \
		-e "s/@PLATFORM@/${platform}/g" \
		-e "/^ADDLDPATH=.*lib\\/\\\"/s|\"\\(.*\\)\"|\"\\1${platform}/:\\1${platform}/server/\"|" \
		< $1 \
		> ${D}/etc/env.d/java/20`basename $1` || die
}

install_mozilla_plugin() {
	local bn
	bn=`basename $1`

	if use mozilla ; then
		dodir /usr/lib/mozilla/plugins
		dosym $1 /usr/lib/mozilla/plugins/${bn}
	fi
}