removed some of the debug logging and added author details
[httpd-crcsyncproxy.git] / build / install-bindist.sh.in
blobf304ac7c8088e75647ce89e141ce42a05e920e5a
1 #!/bin/sh
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 # Usage: install-bindist.sh [ServerRoot]
20 # This script installs the Apache binary distribution and
21 # was automatically created by binbuild.sh.
23 lmkdir()
25 path=""
26 dirs=`echo $1 | sed -e 's%/% %g'`
27 mode=$2
29 set -- ${dirs}
31 for d in ${dirs}
33 path="${path}/$d"
34 if test ! -d "${path}" ; then
35 mkdir ${path}
36 if test $? -ne 0 ; then
37 echo "Failed to create directory: ${path}"
38 exit 1
40 chmod ${mode} ${path}
42 done
45 lcopy()
47 from=$1
48 to=$2
49 dmode=$3
50 fmode=$4
52 test -d ${to} || lmkdir ${to} ${dmode}
53 (cd ${from} && tar -cf - *) | (cd ${to} && tar -xf -)
55 if test "X${fmode}" != X ; then
56 find ${to} -type f -print | xargs chmod ${fmode}
58 if test "X${dmode}" != X ; then
59 find ${to} -type d -print | xargs chmod ${dmode}
64 ## determine path to (optional) Perl interpreter
66 PERL=no-perl5-on-this-system
67 perls='perl5 perl'
68 path=`echo $PATH | sed -e 's/:/ /g'`
69 found_perl=0
71 for dir in ${path} ; do
72 for pperl in ${perls} ; do
73 if test -f "${dir}/${pperl}" ; then
74 if `${dir}/${pperl} -v >/dev/null 2>&1` ; then
75 PERL="${dir}/${pperl}"
76 found_perl=1
77 break
80 done
81 if test $found_perl = 1 ; then
82 break
84 done
86 if [ .$1 = . ]
87 then
88 SR=@default_dir@
89 else
90 SR=$1
92 echo "Installing binary distribution for platform @os@"
93 echo "into directory $SR ..."
94 lmkdir $SR 755
95 lmkdir $SR/proxy 750
96 lmkdir $SR/logs 755
97 lmkdir $SR/build 755
98 lcopy bindist/build $SR/build 750 750
99 lcopy bindist/man $SR/man 755 644
100 if [ -d bindist/modules ]
101 then
102 lcopy bindist/modules $SR/modules 750 750
104 lcopy bindist/include $SR/include 755 644
105 lcopy bindist/icons $SR/icons 755 644
106 lcopy bindist/manual $SR/manual 755 644
107 lcopy bindist/cgi-bin $SR/cgi-bin 750 750
108 if [ -f $SR/bin/envvars ]
109 then
110 echo "[Preserving existing envvars settings.]"
111 cp -p $SR/bin/envvars ./envvars.orig
112 HAD_ENVVARS=yes
113 else
114 HAD_ENVVARS=no
116 lcopy bindist/bin $SR/bin 750 750
117 if [ $HAD_ENVVARS = yes ]
118 then
119 cp -p ./envvars.orig $SR/bin/envvars
120 rm ./envvars.orig
122 lcopy bindist/lib $SR/lib 750 750
123 if [ -d $SR/conf ]
124 then
125 echo "[Preserving existing configuration files.]"
126 cp bindist/conf/*-std.conf $SR/conf/
127 else
128 lcopy bindist/conf $SR/conf 750 640
129 sed -e "s%@default_dir@%$SR%" $SR/conf/httpd-std.conf > $SR/conf/httpd.conf
131 if [ -d $SR/htdocs ]
132 then
133 echo "[Preserving existing htdocs directory.]"
134 else
135 lcopy bindist/htdocs $SR/htdocs 755 644
137 if [ -d $SR/error ]
138 then
139 echo "[Preserving existing error documents directory.]"
140 else
141 lcopy bindist/error $SR/error 755 644
144 sed -e "s;^#!\@perlbin\@.*;#!$PERL;" -e "s;\@exp_installbuilddir\@;$SR/build;" \
145 support/apxs.in > $SR/bin/apxs
146 PRE=`grep "^prefix = " bindist/build/config_vars.mk`
147 PRE=`echo $PRE | sed -e "s;prefix = ;;"`
148 sed -e "s;$PRE;$SR;" bindist/build/config_vars.mk > $SR/build/config_vars.mk
149 sed -e "s;^#!/.*;#!$PERL;" bindist/bin/dbmmanage > $SR/bin/dbmmanage
150 sed -e "s%@default_dir@%$SR%" \
151 -e "s%^HTTPD=.*$%HTTPD=\"$SR/bin/httpd -d $SR\"%" bindist/bin/apachectl > $SR/bin/apachectl
152 sed -e "s%@default_dir@%$SR%" \
153 bindist/bin/envvars-std > $SR/bin/envvars-std
154 if [ $HAD_ENVVARS = no ]
155 then
156 cp -p $SR/bin/envvars-std $SR/bin/envvars
159 echo "Ready."
160 echo " +--------------------------------------------------------+"
161 echo " | You now have successfully installed the Apache @ver@ |"
162 echo " | HTTP server. To verify that Apache actually works |"
163 echo " | correctly you should first check the (initially |"
164 echo " | created or preserved) configuration files: |"
165 echo " | |"
166 echo " | $SR/conf/httpd.conf"
167 echo " | |"
168 echo " | You should then be able to immediately fire up |"
169 echo " | Apache the first time by running: |"
170 echo " | |"
171 echo " | $SR/bin/apachectl start "
172 echo " | |"
173 echo " | Thanks for using Apache. The Apache Group |"
174 echo " | http://www.apache.org/ |"
175 echo " +--------------------------------------------------------+"
176 echo " "