summaryrefslogtreecommitdiff
blob: 10d810f42a5fb7871dabd8133b9160453df3176d (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
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/eclass/java.eclass,v 1.7 2002/12/09 16:09:52 strider Exp $

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"
		java-config --set-system-vm=${VMHANDLE}
	fi
}

pkg_postinst() {
	java_pkg_postinst
}

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

set_java_env() {
	dodir /etc/env.d/java
	sed \
		-e "s/@P@/${P}/g" \
		-e "s/@PN@/${PN}/g" \
		-e "s/@PV@/${PV}/g" \
		-e "s/@PF@/${PF}/g" \
		< $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
}