1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
4 | # contributor license agreements. See the NOTICE file distributed with
|
---|
5 | # this work for additional information regarding copyright ownership.
|
---|
6 | # The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
7 | # (the "License"); you may not use this file except in compliance with
|
---|
8 | # the License. You may obtain a copy of the License at
|
---|
9 | #
|
---|
10 | # http://www.apache.org/licenses/LICENSE-2.0
|
---|
11 | #
|
---|
12 | # Unless required by applicable law or agreed to in writing, software
|
---|
13 | # distributed under the License is distributed on an "AS IS" BASIS,
|
---|
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
15 | # See the License for the specific language governing permissions and
|
---|
16 | # limitations under the License.
|
---|
17 | #
|
---|
18 | #
|
---|
19 | # Usage: install-bindist.sh [ServerRoot]
|
---|
20 | # This script installs the Apache binary distribution and
|
---|
21 | # was automatically created by binbuild.sh.
|
---|
22 |
|
---|
23 |
|
---|
24 | ##
|
---|
25 | ## determine path to (optional) Perl interpreter
|
---|
26 | ##
|
---|
27 | PERL=no-perl5-on-this-system
|
---|
28 | perls='perl5 perl'
|
---|
29 | path=`echo $PATH | sed -e 's/:/ /g'`
|
---|
30 | found_perl=0
|
---|
31 |
|
---|
32 | for dir in ${path} ; do
|
---|
33 | for pperl in ${perls} ; do
|
---|
34 | if test -f "${dir}/${pperl}" ; then
|
---|
35 | if `${dir}/${pperl} -v >/dev/null 2>&1` ; then
|
---|
36 | PERL="${dir}/${pperl}"
|
---|
37 | found_perl=1
|
---|
38 | break
|
---|
39 | fi
|
---|
40 | fi
|
---|
41 | done
|
---|
42 | if test $found_perl = 1 ; then
|
---|
43 | break
|
---|
44 | fi
|
---|
45 | done
|
---|
46 |
|
---|
47 | if [ "x$1" = "x" ]
|
---|
48 | then
|
---|
49 | echo "Number of arguments should be 1. Provide the root directory for the web server."
|
---|
50 | exit 1
|
---|
51 | else
|
---|
52 | SR="$1"
|
---|
53 | fi
|
---|
54 |
|
---|
55 | if [ -f "$SR/bin/envvars" ]
|
---|
56 | then
|
---|
57 | echo "[Preserving existing envvars settings.]"
|
---|
58 | HAD_ENVVARS=yes
|
---|
59 | else
|
---|
60 | HAD_ENVVARS=no
|
---|
61 | fi
|
---|
62 |
|
---|
63 | # Need to run this script from its own directory
|
---|
64 | # instead of whatever directory it may be called from
|
---|
65 | #currentdir=$(cd `dirname "$0"` && pwd)
|
---|
66 | currentdir="`dirname \"$0\"`"
|
---|
67 | currentdir="`cd \"$currentdir\" && pwd`"
|
---|
68 | cd "$currentdir"
|
---|
69 |
|
---|
70 | sed -e "s%\*\*APACHE_HOME_OS\*\*%$SR%" "$SR/conf/httpd.conf.in" > "$SR/conf/httpd.conf"
|
---|
71 |
|
---|
72 | sed -e "s;^#!\@perlbin\@.*;#!$PERL;" -e "s;\@exp_installbuilddir\@;\"$SR/build\";" \
|
---|
73 | apxs.in > "$SR/bin/apxs"
|
---|
74 |
|
---|
75 | # usually we're updating existing files, so need to copy them over into tmp files first
|
---|
76 | PRE=`grep "^prefix = " build/config_vars.mk`
|
---|
77 | PRE=`echo $PRE | sed -e "s;prefix = ;;"`
|
---|
78 | sed -e "s;$PRE;\"$SR\";" build/config_vars.mk > "$SR/build/config_vars.mk.tmp"
|
---|
79 | mv "$SR/build/config_vars.mk.tmp" "$SR/build/config_vars.mk"
|
---|
80 | chmod u+rwx "$SR/build/config_vars.mk"
|
---|
81 |
|
---|
82 | sed -e "s;^#!/.*;#!$PERL;" bin/dbmmanage > "$SR/bin/dbmmanage.tmp"
|
---|
83 | mv "$SR/bin/dbmmanage.tmp" "$SR/bin/dbmmanage"
|
---|
84 |
|
---|
85 | sed -e "s%\*\*APACHE_HOME_OS\*\*%\"$SR\"%" \
|
---|
86 | -e "s%^HTTPD=.*$%HTTPD=\"$SR/bin/httpd\"%" \
|
---|
87 | -e "s%\$HTTPD%\"\$HTTPD\" -d \"$SR\"%" bin/apachectl > "$SR/bin/apachectl.tmp"
|
---|
88 | mv "$SR/bin/apachectl.tmp" "$SR/bin/apachectl"
|
---|
89 | chmod u+rwx "$SR/bin/apachectl"
|
---|
90 |
|
---|
91 | sed -e "s%\*\*APACHE_HOME_OS\*\*%\"$SR\"%" \
|
---|
92 | bin/envvars-std > "$SR/bin/envvars-std.tmp"
|
---|
93 | mv "$SR/bin/envvars-std.tmp" "$SR/bin/envvars-std"
|
---|
94 | chmod u+rwx "$SR/bin/envvars-std"
|
---|
95 |
|
---|
96 | if [ $HAD_ENVVARS = no ]
|
---|
97 | then
|
---|
98 | cp -p "$SR/bin/envvars-std" "$SR/bin/envvars"
|
---|
99 | fi
|
---|
100 |
|
---|
101 |
|
---|
102 | # Non-crucial files (replacements not essential)
|
---|
103 | # but replacing the occurrences of $PRE in them with $SR anyway:
|
---|
104 | cd "$currentdir/conf/extra/"
|
---|
105 | for one_file in httpd-dav.conf httpd-manual.conf httpd-autoindex.conf httpd-vhosts.conf httpd-ssl.conf httpd-multilang-errordoc.conf; do
|
---|
106 | sed -e "s;$PRE;$SR;" "$one_file" > "$one_file.tmp"
|
---|
107 | mv $one_file.tmp $one_file
|
---|
108 | chmod u+w $one_file
|
---|
109 | done
|
---|
110 |
|
---|
111 | cd "$currentdir/conf/original/extra/"
|
---|
112 | for one_file in httpd-dav.conf httpd-manual.conf httpd-autoindex.conf httpd-vhosts.conf httpd-ssl.conf httpd-multilang-errordoc.conf; do
|
---|
113 | sed -e "s;$PRE;$SR;" "$one_file" > "$one_file.tmp"
|
---|
114 | mv $one_file.tmp $one_file
|
---|
115 | chmod u+w $one_file
|
---|
116 | done
|
---|
117 |
|
---|
118 | cd "$currentdir/lib/"
|
---|
119 | for one_file in "apr-util-1/apr_dbd_odbc.la" "apr-util-1/apr_dbd_sqlite3.la" "pkgconfig/apr-util-1.pc" "pkgconfig/apr-1.pc" libaprutil-1.la libapr-1.la; do
|
---|
120 | sed -e "s;$PRE;$SR;" "$one_file" > "$one_file.tmp"
|
---|
121 | mv $one_file.tmp $one_file
|
---|
122 | chmod u+w $one_file
|
---|
123 | done
|
---|
124 |
|
---|
125 | cd "$currentdir/build/"
|
---|
126 | for one_file in config_vars.mk config.nice apr_rules.mk; do
|
---|
127 | sed -e "s;$PRE;$SR;" "$one_file" > "$one_file.tmp"
|
---|
128 | mv $one_file.tmp $one_file
|
---|
129 | chmod u+w $one_file
|
---|
130 | done
|
---|
131 |
|
---|
132 | cd "$currentdir/bin/"
|
---|
133 | for one_file in apu-1-config apr-1-config; do
|
---|
134 | sed -e "s;$PRE;$SR;" "$one_file" > "$one_file.tmp"
|
---|
135 | mv $one_file.tmp $one_file
|
---|
136 | chmod u+w $one_file
|
---|
137 | done
|
---|
138 |
|
---|
139 | cd "$currentdir/include/"
|
---|
140 | for one_file in ap_config_auto.h ap_config_layout.h; do
|
---|
141 | sed -e "s;$PRE;$SR;" "$one_file" > "$one_file.tmp"
|
---|
142 | mv $one_file.tmp $one_file
|
---|
143 | chmod u+w $one_file
|
---|
144 | done
|
---|
145 |
|
---|
146 | sed -e "s;$PRE;$SR;" "$currentdir/conf/original/httpd.conf" > "$currentdir/conf/original/httpd.conf.tmp"
|
---|
147 | mv "$currentdir/conf/original/httpd.conf.tmp" "$currentdir/conf/original/httpd.conf"
|
---|
148 | chmod u+w "$currentdir/conf/original/httpd.conf"
|
---|
149 |
|
---|
150 | echo "Ready."
|
---|
151 | echo " +--------------------------------------------------------+"
|
---|
152 | echo " | You now have successfully installed the Apache |"
|
---|
153 | echo " | HTTP server. To verify that Apache actually works |"
|
---|
154 | echo " | correctly you should first check the (initially |"
|
---|
155 | echo " | created or preserved) configuration files: |"
|
---|
156 | echo " | |"
|
---|
157 | echo " | $SR/conf/httpd.conf"
|
---|
158 | echo " | |"
|
---|
159 | echo " | You should then be able to immediately fire up |"
|
---|
160 | echo " | Apache the first time by running: |"
|
---|
161 | echo " | |"
|
---|
162 | echo " | $SR/bin/apachectl start "
|
---|
163 | echo " | |"
|
---|
164 | echo " | Thanks for using Apache. The Apache Group |"
|
---|
165 | echo " | http://www.apache.org/ |"
|
---|
166 | echo " +--------------------------------------------------------+"
|
---|
167 | echo " "
|
---|