]> granicus.if.org Git - apache/blob - build/install-bindist.sh.in
new file for use with binbuild.sh
[apache] / build / install-bindist.sh.in
1 #!/bin/sh
2 #
3 # Usage: install-bindist.sh [ServerRoot]
4 # This script installs the Apache binary distribution and
5 # was automatically created by binbuild.sh.
6  
7 lmkdir()
8 {
9   path=""
10   dirs=`echo $1 | sed -e 's%/% %g'`
11   mode=$2
12  
13   set -- ${dirs}
14  
15   for d in ${dirs}
16   do
17     path="${path}/$d"
18     if test ! -d "${path}" ; then
19       mkdir ${path}
20       if test $? -ne 0 ; then
21         echo "Failed to create directory: ${path}"
22         exit 1
23       fi
24       chmod ${mode} ${path}
25     fi
26   done
27 }
28  
29 lcopy()
30 {
31   from=$1
32   to=$2
33   dmode=$3
34   fmode=$4
35  
36   test -d ${to} || lmkdir ${to} ${dmode}
37   (cd ${from} && tar -cf - *) | (cd ${to} && tar -xf -)
38  
39   if test "X${fmode}" != X ; then
40     find ${to} -type f -print | xargs chmod ${fmode}
41   fi
42   if test "X${dmode}" != X ; then
43     find ${to} -type d -print | xargs chmod ${dmode}
44   fi
45 }
46  
47 ##
48 ##  determine path to (optional) Perl interpreter
49 ##
50 PERL=no-perl5-on-this-system
51 perls='perl5 perl'
52 path=`echo $PATH | sed -e 's/:/ /g'`
53  
54 for dir in ${path} ;  do
55   for pperl in ${perls} ; do
56     if test -f "${dir}/${pperl}" ; then
57       if `${dir}/${pperl} -v | grep 'version 5\.' >/dev/null 2>&1` ; then
58         PERL="${dir}/${pperl}"
59         break
60       fi
61     fi
62   done
63 done
64  
65 if [ .$1 = . ]
66 then
67   SR=@default_dir@
68 else
69   SR=$1
70 fi
71 echo "Installing binary distribution for platform i686-pc-linux"
72 echo "into directory $SR ..."
73 lmkdir $SR 755
74 lmkdir $SR/proxy 750
75 lmkdir $SR/logs 750
76 lcopy bindist/man $SR/man 755 644
77 if [ -d bindist/modules ]
78 then
79   lcopy bindist/modules $SR/modules 750 750
80 fi
81 lcopy bindist/include $SR/include 755 644
82 lcopy bindist/icons $SR/icons 755 644
83 lcopy bindist/cgi-bin $SR/cgi-bin 750 750
84 lcopy bindist/bin $SR/bin 750 750
85 if [ -d $SR/conf ]
86 then
87   echo "[Preserving existing configuration files.]"
88   cp bindist/conf/*-std.conf $SR/conf/
89 else
90   lcopy bindist/conf $SR/conf 750 640
91   sed -e "s%@default_dir@%$SR%" $SR/conf/httpd-std.conf > $SR/conf/httpd.conf
92 fi
93 if [ -d $SR/htdocs ]
94 then
95   echo "[Preserving existing htdocs directory.]"
96 else
97   lcopy bindist/htdocs $SR/htdocs 755 644
98 fi
99 if [ -d $SR/error ]
100 then
101   echo "[Preserving existing error documents directory.]"
102 else
103   lcopy bindist/error $SR/error 755 644
104 fi
105  
106 sed -e "s;^#!/.*;#!$PERL;" -e "s;\@prefix\@;$SR;" -e "s;\@sbindir\@;$SR/bin;" \
107         -e "s;\@libexecdir\@;$SR/libexec;" -e "s;\@includedir\@;$SR/include;" \
108         -e "s;\@sysconfdir\@;$SR/conf;" bindist/bin/apxs > $SR/bin/apxs
109 sed -e "s;^#!/.*;#!$PERL;" bindist/bin/dbmmanage > $SR/bin/dbmmanage
110 sed -e "s%@default_dir@%$SR%" \
111         -e "s%^HTTPD=.*$%HTTPD=\"$SR/bin/httpd -d $SR\"%" bindist/bin/apachectl > $SR/bin/apachectl
112  
113 echo "Ready."
114 echo " +--------------------------------------------------------+"
115 echo " | You now have successfully installed the Apache @ver@  |"
116 echo " | HTTP server. To verify that Apache actually works      |"
117 echo " | correctly you should first check the (initially        |"
118 echo " | created or preserved) configuration files:             |"
119 echo " |                                                        |"
120 echo " |   $SR/conf/httpd.conf"
121 echo " |                                                        |"
122 echo " | You should then be able to immediately fire up         |"
123 echo " | Apache the first time by running:                      |"
124 echo " |                                                        |"
125 echo " |   $SR/bin/apachectl start "
126 echo " |                                                        |"
127 echo " | Thanks for using Apache.       The Apache Group        |"
128 echo " |                                http://www.apache.org/  |"
129 echo " +--------------------------------------------------------+"
130 echo " "