1 |
egeland |
1.7 |
### RPM cms apache2-conf 1.5
|
2 |
egeland |
1.1 |
# Configuration for additional apache2 modules
|
3 |
egeland |
1.5 |
|
4 |
egeland |
1.7 |
%define confBase http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/*checkout*/COMP
|
5 |
|
|
%define confPath WEBTOOLS/Configuration
|
6 |
|
|
%define confVersion 1.4
|
7 |
|
|
%define confFile apache2.conf?revision=%confVersion&cvsroot=CMSSW
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
Source: %confBase/%confPath/%confFile
|
11 |
egeland |
1.1 |
Requires: mod_perl2 mod_python apache2
|
12 |
|
|
|
13 |
|
|
%prep
|
14 |
|
|
%build
|
15 |
|
|
%install
|
16 |
|
|
|
17 |
egeland |
1.5 |
# Make directory for various resources of this package
|
18 |
|
|
mkdir -p %i/conf %i/bin %i/htdocs %i/logs %i/apps.d %i/var %i/startenv.d
|
19 |
|
|
|
20 |
egeland |
1.7 |
cp %_sourcedir/'%confFile' %i/conf/apache2.conf
|
21 |
egeland |
1.5 |
|
22 |
|
|
# Make a script to start apache with our environment and configuration file
|
23 |
egeland |
1.1 |
|
24 |
|
|
cat << \EOF > %i/bin/httpd
|
25 |
|
|
#!/bin/sh
|
26 |
egeland |
1.6 |
for file in `find %i/startenv.d -type f`; do
|
27 |
|
|
source $file
|
28 |
|
|
done
|
29 |
|
|
|
30 |
eulisse |
1.3 |
@APACHE2_ROOT@/bin/httpd -f %i/conf/apache2.conf ${1+"$@"}
|
31 |
egeland |
1.1 |
EOF
|
32 |
|
|
|
33 |
egeland |
1.5 |
chmod +x %i/bin/httpd
|
34 |
|
|
|
35 |
|
|
# Switch template variables in the configuration file and startup script
|
36 |
|
|
|
37 |
|
|
export SERVER_ROOT=%i
|
38 |
|
|
perl -p -i -e "s|\@SERVER_ROOT\@|$SERVER_ROOT|g;
|
39 |
|
|
s|\@APACHE2_ROOT\@|$APACHE2_ROOT|g;
|
40 |
egeland |
1.1 |
s|\@MOD_PERL2_ROOT\@|$MOD_PERL2_ROOT|g;
|
41 |
|
|
s|\@MOD_PYTHON_ROOT\@|$MOD_PYTHON_ROOT|g;" %i/conf/apache2.conf %i/bin/httpd
|
42 |
|
|
|
43 |
eulisse |
1.3 |
# Generates the dependencies-setup.{sh,csh} files so that
|
44 |
|
|
# sourcing init.{sh,csh} picks up also the environment of
|
45 |
|
|
# dependencies.
|
46 |
|
|
|
47 |
|
|
rm -rf %i/etc/profile.d
|
48 |
|
|
mkdir -p %i/etc/profile.d
|
49 |
|
|
echo '#!/bin/sh' > %{i}/etc/profile.d/dependencies-setup.sh
|
50 |
|
|
echo '#!/bin/tcsh' > %{i}/etc/profile.d/dependencies-setup.csh
|
51 |
|
|
echo requiredtools `echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'`
|
52 |
|
|
for tool in `echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'`
|
53 |
|
|
do
|
54 |
|
|
case X$tool in
|
55 |
|
|
Xdistcc|Xccache )
|
56 |
|
|
;;
|
57 |
|
|
* )
|
58 |
|
|
toolcap=`echo $tool | tr a-z- A-Z_`
|
59 |
|
|
eval echo ". $`echo ${toolcap}_ROOT`/etc/profile.d/init.sh" >> %{i}/etc/profile.d/dependencies-setup.sh
|
60 |
|
|
eval echo "source $`echo ${toolcap}_ROOT`/etc/profile.d/init.csh" >> %{i}/etc/profile.d/dependencies-setup.csh
|
61 |
|
|
;;
|
62 |
|
|
esac
|
63 |
|
|
done
|
64 |
|
|
|
65 |
|
|
perl -p -i -e 's|\. /etc/profile\.d/init\.sh||' %{i}/etc/profile.d/dependencies-setup.sh
|
66 |
|
|
perl -p -i -e 's|source /etc/profile\.d/init\.csh||' %{i}/etc/profile.d/dependencies-setup.csh
|
67 |
|
|
|
68 |
egeland |
1.5 |
# Copy the dependencies to our environment directory
|
69 |
|
|
|
70 |
|
|
cp %i/etc/profile.d/dependencies-setup.sh %i/startenv.d/apache2.sh
|
71 |
|
|
|
72 |
egeland |
1.1 |
%post
|
73 |
|
|
%{relocateConfig}bin/httpd
|
74 |
|
|
%{relocateConfig}conf/apache2.conf
|
75 |
egeland |
1.5 |
%{relocateConfig}startenv.d/apache2.sh
|
76 |
egeland |
1.4 |
%{relocateConfig}etc/profile.d/dependencies-setup.sh
|
77 |
|
|
%{relocateConfig}etc/profile.d/dependencies-setup.csh
|