bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / httpd-2.0.64 / build / install-bindist.sh.in
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 lmkdir()
24 {
25   path=""
26   dirs=`echo $1 | sed -e 's%/% %g'`
27   mode=$2
28  
29   set -- ${dirs}
30  
31   for d in ${dirs}
32   do
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
39       fi
40       chmod ${mode} ${path}
41     fi
42   done
43 }
44  
45 lcopy()
46 {
47   from=$1
48   to=$2
49   dmode=$3
50   fmode=$4
51  
52   test -d ${to} || lmkdir ${to} ${dmode}
53   (cd ${from} && tar -cf - *) | (cd ${to} && tar -xf -)
54  
55   if test "X${fmode}" != X ; then
56     find ${to} -type f -print | xargs chmod ${fmode}
57   fi
58   if test "X${dmode}" != X ; then
59     find ${to} -type d -print | xargs chmod ${dmode}
60   fi
61 }
62  
63 ##
64 ##  determine path to (optional) Perl interpreter
65 ##
66 PERL=no-perl5-on-this-system
67 perls='perl5 perl'
68 path=`echo $PATH | sed -e 's/:/ /g'`
69 found_perl=0
70  
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
78       fi
79     fi
80   done
81   if test $found_perl = 1 ; then
82     break
83   fi
84 done
85  
86 if [ .$1 = . ]
87 then
88   SR=@default_dir@
89 else
90   SR=$1
91 fi
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
103 fi
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
115 fi
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
121 fi
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
130 fi
131 if [ -d $SR/htdocs ]
132 then
133   echo "[Preserving existing htdocs directory.]"
134 else
135   lcopy bindist/htdocs $SR/htdocs 755 644
136 fi
137 if [ -d $SR/error ]
138 then
139   echo "[Preserving existing error documents directory.]"
140 else
141   lcopy bindist/error $SR/error 755 644
142 fi
143  
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
157 fi
158  
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 " "