summaryrefslogtreecommitdiff
blob: c29496835cb82b681f4c4e35ed585ba2d6d2de6f (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-www/tomcat/tomcat-5.0.27-r1.ebuild,v 1.1 2004/07/29 13:22:16 axxo Exp $

inherit eutils

DESCRIPTION="Apache Servlet-2.4/JSP-2.0 Container"

JT_P="jakarta-${P}.tar.gz"
S=${WORKDIR}/jakarta-${P}
SLOT="${PV/.*}"
SRC_URI="mirror://apache/jakarta/tomcat-${SLOT}/v${PV}/bin/${JT_P}"
HOMEPAGE="http://jakarta.apache.org/tomcat"
KEYWORDS="x86 ~ppc ~sparc ~alpha"
LICENSE="Apache-2.0"
DEPEND="sys-apps/sed"
RDEPEND=">=virtual/jdk-1.3
		jikes? ( dev-java/jikes )"
IUSE="doc jikes"

TOMCAT_HOME="/opt/${PN}${SLOT}"
TOMCAT_NAME="${PN}${SLOT}"

src_unpack() {
	unpack ${A}
	cd ${S}
	epatch ${FILESDIR}/${PV}/gentoo.diff
	use jikes && epatch ${FILESDIR}/${PV}/jikes.diff
}

pkg_preinst() {
	enewgroup tomcat
	enewuser tomcat -1 -1 /dev/null tomcat

	chown -R tomcat:tomcat ${D}
	chown -R tomcat:tomcat /var/log/${TOMCAT_NAME}
}

src_install() {
	dodoc RELEASE* RUNNING.txt LICENSE

	# INIT SCRIPTS AND ENV
	insinto /etc/init.d
	insopts -m0750
	newins ${FILESDIR}/${PV}/tomcat.init ${TOMCAT_NAME}

	insinto /etc/conf.d
	insopts -m0644
	newins ${FILESDIR}/${PV}/tomcat.conf ${TOMCAT_NAME}
	use jikes && sed -e "\cCATALINA_OPTScaCATALINA_OPTS=\"-Dbuild.compiler.emacs=true\"" -i ${D}/etc/conf.d/${TOMCAT_NAME}

	insinto /etc/env.d
	insopts -m0644
	newins ${FILESDIR}/${PV}/21tomcat 21${TOMCAT_NAME}

	diropts -m750
	dodir ${TOMCAT_HOME}
	dodir /var/log/${TOMCAT_NAME}
	keepdir /var/log/${TOMCAT_NAME}

	mv conf ${D}/etc/${TOMCAT_NAME}
	mv bin common server shared temp work ${D}${TOMCAT_HOME}
	if ! use doc; then
		rm -rf webapps/{tomcat-docs,jsp-examples,servlets-examples}
	fi
	mv webapps ${D}${TOMCAT_HOME}

	dosym /etc/${TOMCAT_NAME} ${TOMCAT_HOME}/conf
	dosym /var/log/${TOMCAT_NAME} ${TOMCAT_HOME}/logs

	fperms 640 /etc/${TOMCAT_NAME}/tomcat-users.xml
}

pkg_postinst() {
	einfo " "
	einfo " NOTICE!"
	einfo " FILE LOCATIONS:"
	einfo " 1.  Tomcat home directory: ${TOMCAT_HOME}"
	einfo "     Contains application data, configuration files."
	einfo " 2.  Runtime settings: /etc/conf.d/${TOMCAT_NAME}"
	einfo "     Contains CLASSPATH and JAVA_HOME settings."
	einfo " 3.  Configuration:  /etc/${TOMCAT_NAME}"
	einfo " 4.  Logs:  /var/log/${TOMCAT_NAME}/"
	einfo " "
	einfo " "
	einfo " STARTING AND STOPPING TOMCAT:"
	einfo "   /etc/init.d/${TOMCAT_NAME} start"
	einfo "   /etc/init.d/${TOMCAT_NAME} stop"
	einfo "   /etc/init.d/${TOMCAT_NAME} restart"
	einfo " "
	einfo " "
	ewarn " If you are upgrading from older ebuild do NOT use"
	ewarn " /etc/init.d/tomcat and /etc/conf.d/tomcat you probably"
	ewarn " want to remove these. "
	ewarn " A version number has been appended so that tomcat 3, 4 and 5"
	ewarn " can be installed side by side"
	einfo " "
	einfo " NETWORK CONFIGURATION:"
	einfo " By default, Tomcat runs on port 8080.  You can change this"
	einfo " value by editing /etc/${TOMCAT_NAME}/server.xml."
	einfo " "
	einfo " To test Tomcat while it's running, point your web browser to:"
	einfo " http://localhost:8080/"
	einfo " "
	einfo " "
	einfo " BUGS:"
	einfo " Please file any bugs at http://bugs.gentoo.org/ or else it"
	einfo " may not get seen.  Thank you."
	einfo " "
}