source: gsdl/trunk/runtime-src/packages/apache-httpd/install-bindist.sh@ 18879

Last change on this file since 18879 was 18879, checked in by ak19, 15 years ago
  1. More instances where spaces in filepaths need to be escaped; 2. Apachectl is not careful about spaces, so Oran suggested how we can modify the uses of the HTTPD variable in this file to ensure the spaces in paths are correctly preserved
  • Property svn:executable set to *
File size: 4.0 KB
RevLine 
[18814]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##
27PERL=no-perl5-on-this-system
28perls='perl5 perl'
29path=`echo $PATH | sed -e 's/:/ /g'`
30found_perl=0
31
32for 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
45done
46
[18878]47if [ "x$1" = "x" ]
[18814]48then
49 echo "Number of arguments should be 1. Provide the root directory for the web server."
50 exit 1
51else
[18878]52 SR="$1"
[18814]53fi
54
[18878]55if [ -f "$SR/bin/envvars" ]
[18814]56then
57 echo "[Preserving existing envvars settings.]"
58 HAD_ENVVARS=yes
59else
60 HAD_ENVVARS=no
61fi
62
[18827]63# Need to run this script from its own directory
64# instead of whatever directory it may be called from
[18878]65#currentdir=$(cd `dirname "$0"` && pwd)
66currentdir="`dirname \"$0\"`"
67currentdir="`cd \"$currentdir\" && pwd`"
68cd "$currentdir"
[18827]69
[18878]70sed -e "s%\*\*APACHE_HOME_OS\*\*%$SR%" "$SR/conf/httpd.conf.in" > "$SR/conf/httpd.conf"
[18814]71
[18879]72sed -e "s;^#!\@perlbin\@.*;#!$PERL;" -e "s;\@exp_installbuilddir\@;\"$SR/build\";" \
[18878]73 apxs.in > "$SR/bin/apxs"
[18814]74
[18827]75# usually we're updating existing files, so need to copy them over into tmp files first
[18814]76PRE=`grep "^prefix = " build/config_vars.mk`
77PRE=`echo $PRE | sed -e "s;prefix = ;;"`
[18879]78sed -e "s;$PRE;\"$SR\";" build/config_vars.mk > "$SR/build/config_vars.mk.tmp"
[18878]79mv "$SR/build/config_vars.mk.tmp" "$SR/build/config_vars.mk"
80chmod u+rwx "$SR/build/config_vars.mk"
[18814]81
[18878]82sed -e "s;^#!/.*;#!$PERL;" bin/dbmmanage > "$SR/bin/dbmmanage.tmp"
83mv "$SR/bin/dbmmanage.tmp" "$SR/bin/dbmmanage"
[18814]84
[18879]85sed -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"
[18878]88mv "$SR/bin/apachectl.tmp" "$SR/bin/apachectl"
89chmod u+rwx "$SR/bin/apachectl"
[18814]90
[18879]91sed -e "s%\*\*APACHE_HOME_OS\*\*%\"$SR\"%" \
[18878]92 bin/envvars-std > "$SR/bin/envvars-std.tmp"
93mv "$SR/bin/envvars-std.tmp" "$SR/bin/envvars-std"
94chmod u+rwx "$SR/bin/envvars-std"
[18814]95
96if [ $HAD_ENVVARS = no ]
97then
[18878]98 cp -p "$SR/bin/envvars-std" "$SR/bin/envvars"
[18814]99fi
100
101echo "Ready."
102echo " +--------------------------------------------------------+"
103echo " | You now have successfully installed the Apache |"
104echo " | HTTP server. To verify that Apache actually works |"
105echo " | correctly you should first check the (initially |"
106echo " | created or preserved) configuration files: |"
107echo " | |"
108echo " | $SR/conf/httpd.conf"
109echo " | |"
110echo " | You should then be able to immediately fire up |"
111echo " | Apache the first time by running: |"
112echo " | |"
113echo " | $SR/bin/apachectl start "
114echo " | |"
115echo " | Thanks for using Apache. The Apache Group |"
116echo " | http://www.apache.org/ |"
117echo " +--------------------------------------------------------+"
118echo " "
Note: See TracBrowser for help on using the repository browser.