#!/bin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
#
#ident "@(#)install-tomcat 1.22 10/04/22 SMI"
# functions - search for "START HERE" to find start of control flow
. ${SRC}/tools/install.subr
install_tomcat() {
cd ${USRTOMCAT}
rm -rf *
cd ${VARTOMCAT}
rm -rf *
cd ${TOP}/${TOMCATSRC}/output/build
# this stuff goes in $CATALINA_HOME
find bin lib -depth -print |
cpio -pdum ${USRTOMCAT}
# this stuff goes in $CATALINA_BASE (must be writable)
find conf temp webapps -depth -print |
cpio -pdum ${VARTOMCAT}
# create work and logs directories
mkdir ${VARTOMCAT}/work ${VARTOMCAT}/logs
# create link in /etc
cd ${ROOT}/etc
rm -rf tomcat6
ln -s ../var/tomcat${VERSION}/conf tomcat6
# move static stuff to usr and symlink it
cd ${VARTOMCAT}/webapps
find docs -depth -print | cpio -pdum ${USRTOMCAT}
rm -rf docs
ln -s ../../../usr/tomcat${VERSION}/docs docs
# move default web application to different location and install
# redirect html page (for possible altering of ROOT web app) and
# jsp file (as home page when SUNWtcat-examples is not installed).
mv ROOT ROOT.example
mkdir ROOT
_install N ${TOP}/Solaris/index.htm ${VARTOMCAT}/webapps/ROOT/index.htm 644
_install N ${TOP}/Solaris/index.jsp ${VARTOMCAT}/webapps/ROOT/index.jsp 644
# get rid of the MS-DOS files we don't need
cd ${USRTOMCAT}/bin
rm -r *.bat
}
install_man_page() {
cd ${TOP}/Solaris
_install N tomcat.1m.sunman ${PREFIX}/share/man/man1m/tomcat.1m 444
}
install_smf_hook() {
cd ${TOP}/Solaris
_install N http-tomcat${VERSION}.xml ${ROOT}/lib/svc/manifest/network/http-tomcat${VERSION}.xml 444
_install N http-tomcat${VERSION} ${ROOT}/lib/svc/method/http-tomcat${VERSION} 555
}
backup_conf() {
cd ${VARTOMCAT}
gtar cfz conf/CONF.tar.gz conf/*
}
fix_tomcat_perms() {
cd ${VARTOMCAT}
find conf webapps -type f -exec chmod 644 {} \;
find conf webapps -type d -exec chmod 755 {} \;
chmod 600 conf/tomcat-users.xml
find temp -type f -exec chmod 644 {} \;
find temp -type d -exec chmod 755 {} \;
cd ${USRTOMCAT}
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
cd ${USRTOMCAT}/bin
find . -type f -exec chmod 755 {} \;
}
# START HERE - actual script processing starts here
# install locations
PREFIX=${ROOT}/usr
VARDIR=${ROOT}/var
VERSION=6
USRTOMCAT=${PREFIX}/tomcat${VERSION} # aka $CATALINA_HOME
VARTOMCAT=${VARDIR}/tomcat${VERSION} # aka $CATALINA_BASE
ETCAPACHEDIR=${ROOT}/etc/apache
TOP=`pwd`
install_tomcat
install_man_page
install_smf_hook
# all installation should be done before this point, so the functions
# that fixup permissions can get everything that is installed.
fix_tomcat_perms
# backup conf dir (with right perms)
backup_conf
exit 0