summaryrefslogtreecommitdiff
blob: 9a6648595d779e45eeea0966c055afc2d0f424d8 (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-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/eclass/java.eclass,v 1.5 2002/10/20 13:44:03 lostlogic 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
}

pkg_postrm() {
	java_rm_env ${VMHANDLE}
}

java_rm_env() {
	rm -f ${ROOT}/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
}