|
Packit |
90a5c9 |
#!/bin/sh
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
Packit |
90a5c9 |
# contributor license agreements. See the NOTICE file distributed with
|
|
Packit |
90a5c9 |
# this work for additional information regarding copyright ownership.
|
|
Packit |
90a5c9 |
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
Packit |
90a5c9 |
# (the "License"); you may not use this file except in compliance with
|
|
Packit |
90a5c9 |
# the License. You may obtain a copy of the License at
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# Unless required by applicable law or agreed to in writing, software
|
|
Packit |
90a5c9 |
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
90a5c9 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
90a5c9 |
# See the License for the specific language governing permissions and
|
|
Packit |
90a5c9 |
# limitations under the License.
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# Usage: install-bindist.sh [ServerRoot]
|
|
Packit |
90a5c9 |
# This script installs the Apache binary distribution and
|
|
Packit |
90a5c9 |
# was automatically created by binbuild.sh.
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
lmkdir()
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
path=""
|
|
Packit |
90a5c9 |
dirs=`echo $1 | sed -e 's%/% %g'`
|
|
Packit |
90a5c9 |
mode=$2
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
set -- ${dirs}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
for d in ${dirs}
|
|
Packit |
90a5c9 |
do
|
|
Packit |
90a5c9 |
path="${path}/$d"
|
|
Packit |
90a5c9 |
if test ! -d "${path}" ; then
|
|
Packit |
90a5c9 |
mkdir ${path}
|
|
Packit |
90a5c9 |
if test $? -ne 0 ; then
|
|
Packit |
90a5c9 |
echo "Failed to create directory: ${path}"
|
|
Packit |
90a5c9 |
exit 1
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
chmod ${mode} ${path}
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
done
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
lcopy()
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
from=$1
|
|
Packit |
90a5c9 |
to=$2
|
|
Packit |
90a5c9 |
dmode=$3
|
|
Packit |
90a5c9 |
fmode=$4
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
test -d ${to} || lmkdir ${to} ${dmode}
|
|
Packit |
90a5c9 |
(cd ${from} && tar -cf - *) | (cd ${to} && tar -xf -)
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
if test "X${fmode}" != X ; then
|
|
Packit |
90a5c9 |
find ${to} -type f -print | xargs chmod ${fmode}
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
if test "X${dmode}" != X ; then
|
|
Packit |
90a5c9 |
find ${to} -type d -print | xargs chmod ${dmode}
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
##
|
|
Packit |
90a5c9 |
## determine path to (optional) Perl interpreter
|
|
Packit |
90a5c9 |
##
|
|
Packit |
90a5c9 |
PERL=no-perl5-on-this-system
|
|
Packit |
90a5c9 |
perls='perl5 perl'
|
|
Packit |
90a5c9 |
path=`echo $PATH | sed -e 's/:/ /g'`
|
|
Packit |
90a5c9 |
found_perl=0
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
for dir in ${path} ; do
|
|
Packit |
90a5c9 |
for pperl in ${perls} ; do
|
|
Packit |
90a5c9 |
if test -f "${dir}/${pperl}" ; then
|
|
Packit |
90a5c9 |
if `${dir}/${pperl} -v >/dev/null 2>&1` ; then
|
|
Packit |
90a5c9 |
PERL="${dir}/${pperl}"
|
|
Packit |
90a5c9 |
found_perl=1
|
|
Packit |
90a5c9 |
break
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
done
|
|
Packit |
90a5c9 |
if test $found_perl = 1 ; then
|
|
Packit |
90a5c9 |
break
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
done
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
if [ .$1 = . ]
|
|
Packit |
90a5c9 |
then
|
|
Packit |
90a5c9 |
SR=@default_dir@
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
SR=$1
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
echo "Installing binary distribution for platform @os@"
|
|
Packit |
90a5c9 |
echo "into directory $SR ..."
|
|
Packit |
90a5c9 |
lmkdir $SR 755
|
|
Packit |
90a5c9 |
lmkdir $SR/proxy 750
|
|
Packit |
90a5c9 |
lmkdir $SR/logs 755
|
|
Packit |
90a5c9 |
lmkdir $SR/build 755
|
|
Packit |
90a5c9 |
lcopy bindist/build $SR/build 750 750
|
|
Packit |
90a5c9 |
lcopy bindist/man $SR/man 755 644
|
|
Packit |
90a5c9 |
if [ -d bindist/modules ]
|
|
Packit |
90a5c9 |
then
|
|
Packit |
90a5c9 |
lcopy bindist/modules $SR/modules 750 750
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
lcopy bindist/include $SR/include 755 644
|
|
Packit |
90a5c9 |
lcopy bindist/icons $SR/icons 755 644
|
|
Packit |
90a5c9 |
lcopy bindist/manual $SR/manual 755 644
|
|
Packit |
90a5c9 |
lcopy bindist/cgi-bin $SR/cgi-bin 750 750
|
|
Packit |
90a5c9 |
if [ -f $SR/bin/envvars ]
|
|
Packit |
90a5c9 |
then
|
|
Packit |
90a5c9 |
echo "[Preserving existing envvars settings.]"
|
|
Packit |
90a5c9 |
cp -p $SR/bin/envvars ./envvars.orig
|
|
Packit |
90a5c9 |
HAD_ENVVARS=yes
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
HAD_ENVVARS=no
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
lcopy bindist/bin $SR/bin 750 750
|
|
Packit |
90a5c9 |
if [ $HAD_ENVVARS = yes ]
|
|
Packit |
90a5c9 |
then
|
|
Packit |
90a5c9 |
cp -p ./envvars.orig $SR/bin/envvars
|
|
Packit |
90a5c9 |
rm ./envvars.orig
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
lcopy bindist/lib $SR/lib 750 750
|
|
Packit |
90a5c9 |
if [ -d $SR/conf ]
|
|
Packit |
90a5c9 |
then
|
|
Packit |
90a5c9 |
echo "[Preserving existing configuration files.]"
|
|
Packit |
90a5c9 |
cp bindist/conf/*-std.conf $SR/conf/
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
lcopy bindist/conf $SR/conf 750 640
|
|
Packit |
90a5c9 |
sed -e "s%@default_dir@%$SR%" $SR/conf/httpd-std.conf > $SR/conf/httpd.conf
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
if [ -d $SR/htdocs ]
|
|
Packit |
90a5c9 |
then
|
|
Packit |
90a5c9 |
echo "[Preserving existing htdocs directory.]"
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
lcopy bindist/htdocs $SR/htdocs 755 644
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
if [ -d $SR/error ]
|
|
Packit |
90a5c9 |
then
|
|
Packit |
90a5c9 |
echo "[Preserving existing error documents directory.]"
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
lcopy bindist/error $SR/error 755 644
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
sed -e "s;^#!\@perlbin\@.*;#!$PERL;" -e "s;\@exp_installbuilddir\@;$SR/build;" \
|
|
Packit |
90a5c9 |
support/apxs.in > $SR/bin/apxs
|
|
Packit |
90a5c9 |
PRE=`grep "^prefix = " bindist/build/config_vars.mk`
|
|
Packit |
90a5c9 |
PRE=`echo $PRE | sed -e "s;prefix = ;;"`
|
|
Packit |
90a5c9 |
sed -e "s;$PRE;$SR;" bindist/build/config_vars.mk > $SR/build/config_vars.mk
|
|
Packit |
90a5c9 |
sed -e "s;^#!/.*;#!$PERL;" bindist/bin/dbmmanage > $SR/bin/dbmmanage
|
|
Packit |
90a5c9 |
sed -e "s%@default_dir@%$SR%" \
|
|
Packit |
90a5c9 |
-e "s%^HTTPD=.*$%HTTPD=\"$SR/bin/httpd -d $SR\"%" bindist/bin/apachectl > $SR/bin/apachectl
|
|
Packit |
90a5c9 |
sed -e "s%@default_dir@%$SR%" \
|
|
Packit |
90a5c9 |
bindist/bin/envvars-std > $SR/bin/envvars-std
|
|
Packit |
90a5c9 |
if [ $HAD_ENVVARS = no ]
|
|
Packit |
90a5c9 |
then
|
|
Packit |
90a5c9 |
cp -p $SR/bin/envvars-std $SR/bin/envvars
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
echo "Ready."
|
|
Packit |
90a5c9 |
echo " +--------------------------------------------------------+"
|
|
Packit |
90a5c9 |
echo " | You now have successfully installed the Apache @ver@ |"
|
|
Packit |
90a5c9 |
echo " | HTTP server. To verify that Apache actually works |"
|
|
Packit |
90a5c9 |
echo " | correctly you should first check the (initially |"
|
|
Packit |
90a5c9 |
echo " | created or preserved) configuration files: |"
|
|
Packit |
90a5c9 |
echo " | |"
|
|
Packit |
90a5c9 |
echo " | $SR/conf/httpd.conf"
|
|
Packit |
90a5c9 |
echo " | |"
|
|
Packit |
90a5c9 |
echo " | You should then be able to immediately fire up |"
|
|
Packit |
90a5c9 |
echo " | Apache the first time by running: |"
|
|
Packit |
90a5c9 |
echo " | |"
|
|
Packit |
90a5c9 |
echo " | $SR/bin/apachectl start "
|
|
Packit |
90a5c9 |
echo " | |"
|
|
Packit |
90a5c9 |
echo " | Thanks for using Apache. The Apache Group |"
|
|
Packit |
90a5c9 |
echo " | http://www.apache.org/ |"
|
|
Packit |
90a5c9 |
echo " +--------------------------------------------------------+"
|
|
Packit |
90a5c9 |
echo " "
|