author | Jon Tibble <meths@btinternet.com> |
Fri, 10 Feb 2012 16:19:42 +0000 | |
branch | oi_151a |
changeset 114 | b6d40d0a7b17 |
parent 100 | 0a3c3c0e0ff2 |
permissions | -rw-r--r-- |
0 | 1 |
#!/bin/sh |
2 |
# |
|
3 |
# CDDL HEADER START |
|
4 |
# |
|
5 |
# The contents of this file are subject to the terms of the |
|
6 |
# Common Development and Distribution License (the "License"). |
|
7 |
# You may not use this file except in compliance with the License. |
|
8 |
# |
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
10 |
# or http://www.opensolaris.org/os/licensing. |
|
11 |
# See the License for the specific language governing permissions |
|
12 |
# and limitations under the License. |
|
13 |
# |
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
|
19 |
# |
|
20 |
# CDDL HEADER END |
|
21 |
# |
|
22 |
# |
|
7 | 23 |
# Copyright 2010 Sun Microsystems, Inc. All rights reserved. |
0 | 24 |
# Use is subject to license terms. |
25 |
# |
|
7 | 26 |
#ident "@(#)install-apache 1.22 10/01/14 SMI" |
0 | 27 |
|
28 |
. ${SRC}/tools/install.subr |
|
29 |
||
30 |
# functions - search for "START HERE" to find start of control flow |
|
31 |
||
32 |
ins_file() { |
|
33 |
iprog=$1 |
|
34 |
idir=$2 |
|
35 |
imode=$3 |
|
36 |
_install N ${iprog} ${idir}/${iprog} ${imode} |
|
37 |
} |
|
38 |
||
39 |
disable_suexec() { |
|
40 |
cd ${BINDIR} |
|
41 |
rm -f suexec.disabled |
|
42 |
mv suexec suexec.disabled |
|
43 |
} |
|
44 |
||
45 |
install_logs() { |
|
46 |
mkdir -p ${VARDIR}/logs |
|
7 | 47 |
for i in access_log error_log suexec_log |
0 | 48 |
do |
49 |
rm -f ${VARDIR}/logs/$i |
|
50 |
touch ${VARDIR}/logs/$i |
|
51 |
done |
|
52 |
} |
|
53 |
||
54 |
install_proxydir() { |
|
55 |
mkdir -p ${VARDIR}/proxy |
|
56 |
} |
|
57 |
||
58 |
# apache installs the manual in the document root, but we |
|
59 |
# really want it in /usr/apache instead of /var/apache |
|
60 |
# |
|
61 |
move_htdocs() { |
|
62 |
cd ${VARHTDOCS} |
|
63 |
if [ -d manual ]; then |
|
64 |
find manual -depth -print | cpio -pdum ${USRHTDOCS} |
|
65 |
rm -rf manual |
|
66 |
fi |
|
67 |
} |
|
68 |
||
69 |
install_startup_files() { |
|
70 |
cd ${TOP}/Solaris |
|
71 |
_install N apache.sh ${ROOT}/etc/init.d/apache 744 |
|
72 |
_install H ${ROOT}/etc/init.d/apache ${ROOT}/etc/rc3.d/S50apache |
|
73 |
_install H ${ROOT}/etc/init.d/apache ${ROOT}/etc/rc2.d/K16apache |
|
74 |
_install H ${ROOT}/etc/init.d/apache ${ROOT}/etc/rc1.d/K16apache |
|
75 |
_install H ${ROOT}/etc/init.d/apache ${ROOT}/etc/rc0.d/K16apache |
|
76 |
_install H ${ROOT}/etc/init.d/apache ${ROOT}/etc/rcS.d/K16apache |
|
77 |
} |
|
78 |
||
79 |
install_readme() { |
|
80 |
cd ${TOP}/Solaris |
|
81 |
ins_file README.Solaris ${CONFDIR} 444 |
|
82 |
} |
|
83 |
||
84 |
install_tomcatcon() { |
|
85 |
cd ${TOP}/${TOMCATCON_VERSION}/native/apache-1.3 |
|
86 |
ins_file mod_jk.so ${LIBEXECDIR} 555 root bin |
|
87 |
||
88 |
cd ${TOP}/Solaris |
|
89 |
ins_file jk.conf ${CONFDIR} 555 |
|
90 |
ins_file workers.properties ${CONFDIR} 555 |
|
91 |
} |
|
92 |
||
93 |
install_auth_gss() { |
|
94 |
cd ${TOP}/mod_auth_gss |
|
95 |
ins_file mod_auth_gss.so ${LIBEXECDIR} 555 |
|
96 |
} |
|
97 |
||
98 |
fix_config_files() { |
|
99 |
cd ${CONFDIR} |
|
100 |
rm -f *.default |
|
101 |
sed -f ${TOP}/Solaris/httpdconf.sed httpd.conf > httpd.conf-example |
|
102 |
rm -f httpd.conf |
|
103 |
} |
|
104 |
||
105 |
# remove stuff from the proto dir that apache installs and that |
|
106 |
# we don't want to ship |
|
107 |
||
108 |
cleanup_proto() { |
|
109 |
rm -rf ${ROOT}/var/run/apache |
|
110 |
} |
|
111 |
||
112 |
post_process() { |
|
113 |
cd ${BINDIR} |
|
7 | 114 |
for i in ab htdigest htpasswd httpd logresolve \ |
0 | 115 |
rotatelogs suexec.disabled |
116 |
do |
|
117 |
chmod u+w ${i} |
|
118 |
${SRC}/tools/post_process ${i} |
|
119 |
chmod u-w ${i} |
|
120 |
done |
|
121 |
||
122 |
cd ${LIBEXECDIR} |
|
123 |
for i in *.so |
|
124 |
do |
|
125 |
chmod u+w ${i} |
|
126 |
${SRC}/tools/post_process_so ${i} |
|
127 |
chmod u-w ${i} |
|
128 |
done |
|
129 |
} |
|
130 |
||
131 |
fix_apache_perms() { |
|
132 |
chmod 744 ${ROOT}/etc/init.d/apache |
|
133 |
||
134 |
cd ${CONFDIR} |
|
135 |
find . -type d -exec chmod 755 {} \; |
|
136 |
find . -type f -exec chmod 644 {} \; |
|
137 |
||
138 |
# special fixups for mod_ssl config dirs/files |
|
139 |
||
140 |
chmod 700 ssl.key |
|
141 |
||
142 |
# for distribution packages, we don't ship server |
|
143 |
# certs or keys, but for testing, you can comment |
|
144 |
# the following lines, and the dummy certificate |
|
145 |
# we generate during the build will be left in place. |
|
146 |
||
147 |
cd ssl.crt |
|
148 |
rm -f *.[01] .[01] |
|
149 |
rm -f *.crt |
|
150 |
cd ../ssl.csr |
|
151 |
rm -f *.csr |
|
152 |
cd ../ssl.key |
|
153 |
rm -f *.key |
|
154 |
cd ../ssl.prm |
|
155 |
rm -f *.prm |
|
156 |
||
157 |
# end of mod_ssl fixups |
|
158 |
||
159 |
cd ${PREFIX} |
|
7 | 160 |
APDIRS="bin htdocs include libexec man perl5" |
0 | 161 |
find ${APDIRS} -type d -exec chmod 755 {} \; |
162 |
find ${APDIRS} -type f -exec chmod 555 {} \; |
|
163 |
||
164 |
cd ${BINDIR} |
|
165 |
chmod 700 suexec.disabled |
|
166 |
||
167 |
cd ${MANDIR} |
|
168 |
find . -type f -exec chmod 444 {} \; |
|
169 |
||
170 |
cd ${INCLUDEDIR} |
|
171 |
find . -type f -exec chmod 644 {} \; |
|
172 |
||
173 |
cd ${VARDIR} |
|
7 | 174 |
APDIRS="cgi-bin htdocs icons logs proxy" |
0 | 175 |
find ${APDIRS} -type d -exec chmod 755 {} \; |
176 |
find ${APDIRS} -type f -exec chmod 644 {} \; |
|
177 |
||
178 |
cd ${VARDIR}/cgi-bin |
|
179 |
chmod 555 * |
|
180 |
||
181 |
chmod 755 ${VARDIR}/proxy |
|
182 |
||
183 |
chmod 755 ${VARDIR}/logs |
|
184 |
||
185 |
cd ${VARDIR}/logs |
|
186 |
chmod 644 * |
|
187 |
} |
|
188 |
||
189 |
fix_apachectl() { |
|
190 |
cd ${BINDIR} |
|
191 |
rm -f apachectl.out |
|
192 |
sed -e 's/GOOP/HTTPD/g' apachectl > apachectl.out |
|
193 |
rm -f apachectl |
|
194 |
mv apachectl.out apachectl |
|
195 |
chmod 555 apachectl |
|
196 |
} |
|
197 |
||
198 |
fix_apxs() { |
|
199 |
cd ${BINDIR} |
|
200 |
rm -f apxs.out |
|
201 |
sed -e '/^my $CFG_CC/c\ |
|
202 |
my $CFG_CC = q(cc);' apxs > apxs.out |
|
203 |
rm -f apxs |
|
204 |
mv apxs.out apxs |
|
205 |
chmod 555 apxs |
|
206 |
} |
|
207 |
||
208 |
# START HERE - actual script processing starts here |
|
209 |
||
210 |
# Even though this is called "install-apache", it doesn't really |
|
211 |
# install the whole thing. The perl side of mod_perl is installed |
|
212 |
# by make all, we just need to fix permissions. Much of apache |
|
213 |
# itself is installed by make install - again, we need to fix |
|
214 |
# permissions. What we install here are modules that apache |
|
215 |
# won't install as part of its normal build. Each install task |
|
216 |
# is a function, so it's relatively easy to add new stuff. |
|
217 |
||
218 |
APACHE_VERSION=`grep "^SERVER=" Makefile.sfw | sed s/SERVER=//` |
|
219 |
MOD_PERL_VERSION=mod_perl-1.31 |
|
220 |
TOMCATCON_VERSION=tomcat-connectors-1.2.27-src |
|
221 |
||
222 |
# install locations |
|
223 |
||
224 |
PREFIX=${ROOT}/usr/apache |
|
225 |
CONFDIR=${ROOT}/etc/apache |
|
226 |
VARDIR=${ROOT}/var/apache |
|
227 |
DEFDIR=${ROOT}/etc/default |
|
228 |
BINDIR=${PREFIX}/bin |
|
229 |
USRHTDOCS=${PREFIX}/htdocs |
|
230 |
INCLUDEDIR=${PREFIX}/include |
|
231 |
LIBEXECDIR=${PREFIX}/libexec |
|
232 |
MANDIR=${PREFIX}/man |
|
233 |
MAN1DIR=${PREFIX}/man/man1 |
|
234 |
MAN3DIR=${PREFIX}/man/man3 |
|
235 |
MAN8DIR=${PREFIX}/man/man8 |
|
236 |
PERLDIR=${PREFIX}/perl5 |
|
237 |
||
238 |
VARHTDOCS=${VARDIR}/htdocs |
|
239 |
||
240 |
TOP=`pwd` |
|
241 |
||
242 |
disable_suexec |
|
243 |
install_logs |
|
244 |
install_proxydir |
|
245 |
install_readme |
|
246 |
install_tomcatcon |
|
247 |
install_auth_gss |
|
248 |
move_htdocs |
|
249 |
install_startup_files |
|
250 |
cleanup_proto |
|
251 |
fix_config_files |
|
252 |
post_process |
|
253 |
||
254 |
# all installation should be done before this point, so the functions |
|
255 |
# that fixup permissions can get everything that is installed. |
|
256 |
||
257 |
fix_apache_perms |
|
258 |
||
259 |
# also need to make one last fix to apachectl after it's installed. |
|
260 |
# can't patch it prior to install, because apache install runs sed |
|
261 |
# on it and messes up our change. Also, apxs winds up with the |
|
262 |
# path to cc that we use to compile, so we need to fix that to |
|
263 |
# be generic. |
|
264 |
||
265 |
fix_apachectl |
|
266 |
fix_apxs |
|
267 |
||
100
0a3c3c0e0ff2
imported patch sfw-perl510.patch
Alasdair Lumsden <al@everycity.co.uk>
parents:
7
diff
changeset
|
268 |
for pmfile in ${PERLDIR}/5.10.0/*/Apache/Resource.pm |
0 | 269 |
do |
270 |
if [ -f ${pmfile} ]; then |
|
271 |
_fixup_perl ${pmfile} |
|
272 |
chmod 555 ${pmfile} |
|
273 |
fi |
|
274 |
done |
|
275 |
||
276 |
exit 0 |