1 |
### RPM cms tom T0M_0_0_5
|
2 |
# the last string specifies the cvs tag to be used in the checkout command, don't know what the other strings are.
|
3 |
## NOCOMPILER
|
4 |
|
5 |
%define cvstag %{realversion}
|
6 |
# define version of tom to use, realversion is supplied by CMS
|
7 |
%define tom_version %{realversion}
|
8 |
|
9 |
Source: cvs://:pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW?passwd=AA_:yZZ3e&module=T0/src/java/tom&export=tom&tag=-r%{cvstag}&output=/tom.tar.gz
|
10 |
# RPM dependencies, if are RPM files
|
11 |
Requires: java-jdk apache-ant apache-tomcat
|
12 |
|
13 |
%prep
|
14 |
# this section is for preparation such as declaring variables
|
15 |
|
16 |
%setup -n tom
|
17 |
# 'tom' matches the export parameter in line 7
|
18 |
# will un-tar the tom tar ball
|
19 |
|
20 |
%build
|
21 |
# will be on top directory in tar ball
|
22 |
# make the war file using ant
|
23 |
cd src/java/tom
|
24 |
mkdir build temp
|
25 |
echo "PWD=$PWD"
|
26 |
source $JAVA_JDK_ROOT/etc/profile.d/init.sh
|
27 |
export JAVA_HOME=$JAVA_JDK_ROOT
|
28 |
ant
|
29 |
rm -rf %i/etc/profile.d
|
30 |
mkdir -p %i/etc/profile.d
|
31 |
echo '#!/bin/sh' > %{i}/etc/profile.d/dependencies-setup.sh
|
32 |
echo '#!/bin/tcsh' > %{i}/etc/profile.d/dependencies-setup.csh
|
33 |
echo requiredtools `echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'`
|
34 |
for tool in `echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'`
|
35 |
do
|
36 |
case X$tool in
|
37 |
Xdistcc|Xccache )
|
38 |
;;
|
39 |
* )
|
40 |
toolcap=`echo $tool | tr a-z- A-Z_`
|
41 |
eval echo ". $`echo ${toolcap}_ROOT`/etc/profile.d/init.sh" >> %{i}/etc/profile.d/dependencies-setup.sh
|
42 |
eval echo "source $`echo ${toolcap}_ROOT`/etc/profile.d/init.csh" >> %{i}/etc/profile.d/dependencies-setup.csh
|
43 |
;;
|
44 |
esac
|
45 |
done
|
46 |
|
47 |
%install
|
48 |
# copy war file, %{i} means install area
|
49 |
cp -p src/java/tom/build/tom.war %{i}/
|
50 |
# copy properties file
|
51 |
cp -p src/java/tom/tom.properties %{i}/
|
52 |
chmod 700 %{i}/tom.properties
|
53 |
# this is where I can modify the tomcat start script to add a parameter
|
54 |
# can not start or stop tomcat
|
55 |
|
56 |
%post
|
57 |
# installs script to set up environment
|
58 |
%{relocateConfig}etc/profile.d/dependencies-setup.sh
|
59 |
%{relocateConfig}etc/profile.d/dependencies-setup.csh
|
60 |
# copy war file
|
61 |
. $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.sh
|
62 |
cp -p $RPM_INSTALL_PREFIX/%{pkgrel}/tom.war $APACHE_TOMCAT_ROOT/webapps
|
63 |
mkdir -p $APACHE_TOMCAT_ROOT/temp/tom
|
64 |
sed "s:dir=:dir=$APACHE_TOMCAT_ROOT/temp/tom/:;s%dataDir=%dataDir=file:///$APACHE_TOMCAT_ROOT/temp/tom/%" $RPM_INSTALL_PREFIX/%{pkgrel}/tom.properties > $APACHE_TOMCAT_ROOT/etc/tom.properties
|
65 |
chmod 700 $APACHE_TOMCAT_ROOT/etc/tom.properties
|
66 |
|
67 |
echo "##### tom install is complete #####"
|
68 |
|