install-bindist.sh.in revision cd2e0fb5f8e86eecb278e9d623f4c272d96f5e3c
2N/A#!/bin/sh
2N/A#
2N/A# Usage: install-bindist.sh [ServerRoot]
2N/A# This script installs the Apache binary distribution and
2N/A# was automatically created by binbuild.sh.
2N/A
2N/Almkdir()
2N/A{
2N/A path=""
2N/A dirs=`echo $1 | sed -e 's%/% %g'`
2N/A mode=$2
2N/A
2N/A set -- ${dirs}
2N/A
2N/A for d in ${dirs}
2N/A do
2N/A path="${path}/$d"
2N/A if test ! -d "${path}" ; then
2N/A mkdir ${path}
2N/A if test $? -ne 0 ; then
1392N/A echo "Failed to create directory: ${path}"
2N/A exit 1
2N/A fi
2N/A chmod ${mode} ${path}
2N/A fi
2N/A done
2N/A}
2N/A
2N/Alcopy()
2N/A{
2N/A from=$1
59N/A to=$2
59N/A dmode=$3
2N/A fmode=$4
2N/A
2N/A test -d ${to} || lmkdir ${to} ${dmode}
2N/A (cd ${from} && tar -cf - *) | (cd ${to} && tar -xf -)
26N/A
26N/A if test "X${fmode}" != X ; then
2N/A find ${to} -type f -print | xargs chmod ${fmode}
26N/A fi
38N/A if test "X${dmode}" != X ; then
181N/A find ${to} -type d -print | xargs chmod ${dmode}
26N/A fi
26N/A}
26N/A
26N/A##
26N/A## determine path to (optional) Perl interpreter
26N/A##
26N/APERL=no-perl5-on-this-system
26N/Aperls='perl5 perl'
700N/Apath=`echo $PATH | sed -e 's/:/ /g'`
700N/Afound_perl=0
26N/A
26N/Afor dir in ${path} ; do
26N/A for pperl in ${perls} ; do
26N/A if test -f "${dir}/${pperl}" ; then
151N/A if `${dir}/${pperl} -v >/dev/null 2>&1` ; then
206N/A PERL="${dir}/${pperl}"
26N/A found_perl=1
26N/A break
26N/A fi
26N/A fi
26N/A done
26N/A if test $found_perl = 1 ; then
26N/A break
2N/A fi
26N/Adone
26N/A
26N/Aif [ .$1 = . ]
26N/Athen
883N/A SR=@default_dir@
26N/Aelse
26N/A SR=$1
26N/Afi
26N/Aecho "Installing binary distribution for platform @os@"
1043N/Aecho "into directory $SR ..."
586N/Almkdir $SR 755
26N/Almkdir $SR/proxy 750
93N/Almkdir $SR/logs 755
166N/Almkdir $SR/build 755
26N/Alcopy bindist/build $SR/build 750 750
379N/Alcopy bindist/man $SR/man 755 644
379N/Aif [ -d bindist/modules ]
2N/Athen
26N/A lcopy bindist/modules $SR/modules 750 750
26N/Afi
181N/Alcopy bindist/include $SR/include 755 644
181N/Alcopy bindist/icons $SR/icons 755 644
181N/Alcopy bindist/manual $SR/manual 755 644
99N/Alcopy bindist/cgi-bin $SR/cgi-bin 750 750
59N/Aif [ -f $SR/bin/envvars ]
12N/Athen
30N/A echo "[Preserving existing envvars settings.]"
1256N/A cp -p $SR/bin/envvars ./envvars.orig
1256N/A HAD_ENVVARS=yes
1256N/Aelse
1256N/A HAD_ENVVARS=no
1256N/Afi
1256N/Alcopy bindist/bin $SR/bin 750 750
1256N/Aif [ $HAD_ENVVARS = yes ]
1256N/Athen
1256N/A cp -p ./envvars.orig $SR/bin/envvars
1256N/A rm ./envvars.orig
1256N/Afi
1256N/Alcopy bindist/lib $SR/lib 750 750
1256N/Aif [ -d $SR/conf ]
1256N/Athen
1256N/A echo "[Preserving existing configuration files.]"
1256N/A cp bindist/conf/*-std.conf $SR/conf/
1256N/Aelse
1256N/A lcopy bindist/conf $SR/conf 750 640
1256N/A sed -e "s%@default_dir@%$SR%" $SR/conf/httpd-std.conf > $SR/conf/httpd.conf
1256N/Afi
1256N/Aif [ -d $SR/htdocs ]
1256N/Athen
1256N/A echo "[Preserving existing htdocs directory.]"
1256N/Aelse
1413N/A lcopy bindist/htdocs $SR/htdocs 755 644
1256N/Afi
26N/Aif [ -d $SR/error ]
26N/Athen
1256N/A echo "[Preserving existing error documents directory.]"
2N/Aelse
26N/A lcopy bindist/error $SR/error 755 644
1256N/Afi
1256N/A
185N/Ased -e "s;^#!\@perlbin\@.*;#!$PERL;" -e "s;\@exp_installbuilddir\@;$SR/build;" \
2N/A support/apxs.in > $SR/bin/apxs
255N/APRE=`grep "^prefix = " bindist/build/config_vars.mk`
145N/APRE=`echo $PRE | sed -e "s;prefix = ;;"`
7N/Ased -e "s;$PRE;$SR;" bindist/build/config_vars.mk > $SR/build/config_vars.mk
26N/Ased -e "s;^#!/.*;#!$PERL;" bindist/bin/dbmmanage > $SR/bin/dbmmanage
26N/Ased -e "s%@default_dir@%$SR%" \
38N/A -e "s%^HTTPD=.*$%HTTPD=\"$SR/bin/httpd -d $SR\"%" bindist/bin/apachectl > $SR/bin/apachectl
26N/Ased -e "s%@default_dir@%$SR%" \
197N/A bindist/bin/envvars-std > $SR/bin/envvars-std
197N/Aif [ $HAD_ENVVARS = no ]
197N/Athen
197N/A cp -p $SR/bin/envvars-std $SR/bin/envvars
197N/Afi
26N/A
30N/Aecho "Ready."
26N/Aecho " +--------------------------------------------------------+"
46N/Aecho " | You now have successfully installed the Apache @ver@ |"
46N/Aecho " | HTTP server. To verify that Apache actually works |"
46N/Aecho " | correctly you should first check the (initially |"
64N/Aecho " | created or preserved) configuration files: |"
64N/Aecho " | |"
26N/Aecho " | $SR/conf/httpd.conf"
46N/Aecho " | |"
46N/Aecho " | You should then be able to immediately fire up |"
46N/Aecho " | Apache the first time by running: |"
2N/Aecho " | |"
1256N/Aecho " | $SR/bin/apachectl start "
1256N/Aecho " | |"
1256N/Aecho " | Thanks for using Apache. The Apache Group |"
1256N/Aecho " | http://www.apache.org/ |"
1256N/Aecho " +--------------------------------------------------------+"
1256N/Aecho " "
1256N/A