| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- ##
- ## tomcat.spec -- OpenPKG RPM Package Specification
- ## Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/>
- ##
- ## Permission to use, copy, modify, and distribute this software for
- ## any purpose with or without fee is hereby granted, provided that
- ## the above copyright notice and this permission notice appear in all
- ## copies.
- ##
- ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
- ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- ## SUCH DAMAGE.
- ##
- # package information
- Name: tomcat
- Summary: Apache Tomcat
- URL: http://tomcat.apache.org/
- Vendor: Apache Software Foundation
- Packager: OpenPKG Foundation e.V.
- Distribution: OpenPKG Community
- Class: EVAL
- Group: Web
- License: Apache Software License 2.0
- Version: 7.0.27
- Release: 20120406
- # list of sources
- Source0: http://www.apache.org/dist/tomcat/tomcat-7/v%{version}/bin/apache-tomcat-%{version}.tar.gz
- Source1: rc.tomcat
- Patch0: tomcat.patch
- # build information
- BuildPreReq: OpenPKG, openpkg >= 20100101, apg
- PreReq: OpenPKG, openpkg >= 20100101, java, JAVA-JDK
- %description
- Apache Tomcat is the reference implementation of both a Java Servlet
- API 3.0, JavaServer Pages (JSP) 2.2 compliant container.
- %track
- prog tomcat = {
- version = %{version}
- url = http://www.apache.org/dist/tomcat/tomcat-7/
- regex = (v\d+\.\d+\.\d+)
- url = http://www.apache.org/dist/tomcat/tomcat-7/__NEWVER__/bin/
- regex = apache-tomcat-(\d+\.\d+\.\d+)\.tar\.gz
- }
- %prep
- %setup -q -n apache-tomcat-%{version}
- %patch -p0
- %build
- %install
- # create installation tree
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
- $RPM_BUILD_ROOT%{l_prefix}/etc/tomcat \
- $RPM_BUILD_ROOT%{l_prefix}/libexec/tomcat \
- $RPM_BUILD_ROOT%{l_prefix}/share/tomcat/doc \
- $RPM_BUILD_ROOT%{l_prefix}/var/tomcat/log \
- $RPM_BUILD_ROOT%{l_prefix}/var/tomcat/temp \
- $RPM_BUILD_ROOT%{l_prefix}/var/tomcat/work
- # unpack vendor distribution and relocate to final location
- %{l_tar} -cf - \
- bin/*.sh bin/*.jar conf lib webapps |\
- ( umask 022
- cd $RPM_BUILD_ROOT%{l_prefix}/libexec/tomcat/
- %{l_tar} -xf -
- ) || exit $?
- # relocate configuration directory
- mv $RPM_BUILD_ROOT%{l_prefix}/libexec/tomcat/conf/* \
- $RPM_BUILD_ROOT%{l_prefix}/etc/tomcat/
- rmdir \
- $RPM_BUILD_ROOT%{l_prefix}/libexec/tomcat/conf
- ln -s \
- %{l_prefix}/etc/tomcat \
- $RPM_BUILD_ROOT%{l_prefix}/libexec/tomcat/conf
- # relocate web application directory
- mv $RPM_BUILD_ROOT%{l_prefix}/libexec/tomcat/webapps \
- $RPM_BUILD_ROOT%{l_prefix}/var/tomcat/webapps
- ln -s \
- %{l_prefix}/var/tomcat/webapps \
- $RPM_BUILD_ROOT%{l_prefix}/libexec/tomcat/webapps
- # relocate working directory
- ln -s \
- %{l_prefix}/var/tomcat/work \
- $RPM_BUILD_ROOT%{l_prefix}/libexec/tomcat/work
- # relocate logfile and temporary directory
- %{l_shtool} subst %{l_value -s -a} \
- -e "s;@l_password@;`apg -n1 -a0 -m8 -x8`;g" \
- $RPM_BUILD_ROOT%{l_prefix}/etc/tomcat/server.xml
- %{l_shtool} subst \
- -e 's;"$CATALINA_BASE"/temp;%{l_prefix}/var/tomcat/temp;' \
- -e 's;"$CATALINA_BASE"/logs;%{l_prefix}/var/tomcat/log;' \
- $RPM_BUILD_ROOT%{l_prefix}/libexec/tomcat/bin/catalina.sh
- # make scripts executable
- chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/tomcat/bin/*
- # install run-command script
- %{l_shtool} install -c -m 755 %{l_value -s -a} \
- %{SOURCE rc.tomcat} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
- # determine package files
- %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
- %{l_files_std} \
- '%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/tomcat/log' \
- '%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/tomcat/temp' \
- '%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/tomcat/work' \
- '%dir %attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/tomcat' \
- '%config %attr(644,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/tomcat/*'
- %files -f files
- %clean
- %post
- # after upgrade, restart service
- if [ $1 -eq 2 ]; then
- eval `%{l_rc} tomcat status 2>/dev/null`
- [ ".$tomcat_active" = .yes ] && %{l_rc} tomcat restart
- fi
- exit 0
- %preun
- if [ $1 -eq 0 ]; then
- # before erase, stop service and remove log files
- %{l_rc} tomcat stop 2>/dev/null
- rm -f $RPM_INSTALL_PREFIX/var/tomcat/log/*
- rm -rf $RPM_INSTALL_PREFIX/var/tomcat/temp/*
- rm -rf $RPM_INSTALL_PREFIX/var/tomcat/work/*
- fi
- exit 0
|