1 #!/usr/bin/ksh93 2 3 # 4 # CDDL HEADER START 5 # 6 # The contents of this file are subject to the terms of the 7 # Common Development and Distribution License (the "License"). 8 # You may not use this file except in compliance with the License. 9 # 10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11 # or http://www.opensolaris.org/os/licensing. 12 # See the License for the specific language governing permissions 13 # and limitations under the License. 14 # 15 # When distributing Covered Code, include this CDDL HEADER in each 16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17 # If applicable, add the following below this CDDL HEADER, with the 18 # fields enclosed by brackets "[]" replaced with your own identifying 19 # information: Portions Copyright [yyyy] [name of copyright owner] 20 # 21 # CDDL HEADER END 22 # 23 24 # 25 # Copyright 2009 Sun Microsystems, Inc. All rights reserved. 26 # Use is subject to license terms. 27 # 28 #ident "@(#)install-apache2-64 1.8 09/10/26 SMI" 29 # 30 31 set -o errexit 32 33 . ${SRC}/tools/install.subr 34 . ${SRC}/cmd/apr/apr-1.3/apr.build.env 35 . ${SRC}/cmd/apr-util/apr-util-1.3/apr-util.build.env 36 . ${SRC}/cmd/apache2/apache.build.env 37 38 # functions - search for "START HERE" to find start of control flow 39 40 ins_file() { 41 iprog=$1 42 idir=$2 43 imode=$3 44 _install N ${iprog} ${idir}/${iprog} ${imode} 45 } 46 47 ins_file_modified() { 48 iprog=$1 49 idir=$2 50 idestfile=$3 51 imode=$4 52 _install N ${iprog} ${idir}/${idestfile} ${imode} 53 } 54 55 disable_suexec() { 56 cd ${BINDIR} 57 if [ -f "./suexec" ]; then 58 mv suexec suexec.disabled 59 fi 60 } 61 62 fix_config_files() { 63 cd ${TOP}/Solaris 64 ins_file modules-64.load ${CONFDIR}/conf.d 644 65 66 cd ${CONFDIR} 67 68 # Strip the 64-bit LoadModule directives from httpd.conf and put them in a 69 # separate file 70 grep "^LoadModule " ${TOP}/Solaris/64/httpd.conf >> conf.d/modules-64.load 71 sed -f ${TOP}/Solaris/64/loadmodules.sed conf.d/modules-64.load > conf.d/modules-64.load.new 72 sed -e "s;/${MACH64}/;/64/;g" conf.d/modules-64.load.new > conf.d/modules-64.load 73 rm -f conf.d/modules-64.load.new 74 75 set +e 76 cd ${BINDIR} 77 # Add logic to source the user-customizable envvars file 78 ENVVAR_INCLUDE=`grep "/envvars" envvars` 79 if [ "x${ENVVAR_INCLUDE}" = "x" ]; then 80 sed -f ${TOP}/Solaris/envvars.sed envvars > envvars.1 81 mv envvars.1 envvars 82 fi 83 set -e 84 } 85 86 install_real_bins() { 87 cd ${TOP}/${APACHE_WORKER_DIR64}/.libs 88 ins_file_modified httpd ${BINDIR} httpd.worker 555 89 90 cd ${TOP}/${APACHE_PREFORK_DIR64}/.libs 91 ins_file httpd ${BINDIR} 555 92 93 cd ${TOP}/${APACHE_PREFORK_DIR}/support/.libs 94 for i in \ 95 ab \ 96 checkgid \ 97 htcacheclean \ 98 htdbm \ 99 htdigest \ 100 htpasswd \ 101 httxt2dbm \ 102 logresolve \ 103 rotatelogs 104 do 105 ins_file ${i} ${BINDIR} 555 106 done 107 } 108 109 install_smf_hooks() { 110 cd ${TOP}/Solaris/64 111 ins_file http-apache22 ${ROOT}/lib/svc/method 555 112 } 113 114 install_auth_gss() { 115 cd ${MOD_AUTH_GSS_DIR} 116 ins_file mod_auth_gss.so ${LIBEXECDIR} 555 117 } 118 119 post_process() { 120 cd ${BINDIR} 121 for i in \ 122 ab \ 123 checkgid \ 124 htcacheclean \ 125 htdbm \ 126 htdigest \ 127 htpasswd \ 128 httpd \ 129 httpd.worker \ 130 httxt2dbm \ 131 logresolve \ 132 rotatelogs \ 133 suexec.disabled 134 do 135 chmod u+w ${i} 136 ${SRC}/tools/post_process ${i} 137 chmod u-w ${i} 138 done 139 140 cd ${LIBEXECDIR} 141 for i in *.so 142 do 143 chmod u+w ${i} 144 ${SRC}/tools/post_process_so ${i} 145 chmod u-w ${i} 146 done 147 } 148 149 # apache2 stores all kinds of info about the build environment 150 # in $ROOT/usr/apache2/build. We need to massage this so it 151 # is all relative to an installed machine, rather than a build 152 # proto area. 153 fix_build_config() { 154 cd ${BUILDDIR} 155 ${GPATCH} ${GPATCH_FLAGS} < ${TOP}/patches/64/rules.mk.patch.install 156 ${GPATCH} ${GPATCH_FLAGS} < ${TOP}/patches/64/special.mk.patch.install 157 } 158 159 # create soft links to the binaries in ${BINDIR} from /usr/bin 160 # e.g., /usr/bin/amd64/ab --> /usr/apache2/2.2/bin/amd64/ab 161 # /usr/bin/sparcv9/ab --> /usr/apache2/2.2/bin/sparcv9/ab 162 # Also, create symlink "64" to $ISA directory 163 # e.g., /usr/apache2/2.2/bin/64 -> amd64 164 create_sym_links() { 165 cd ${BINDIR} 166 for i in \ 167 ab \ 168 apxs \ 169 dbmmanage \ 170 htcacheclean \ 171 htdbm \ 172 htdigest \ 173 htpasswd \ 174 httxt2dbm \ 175 logresolve \ 176 rotatelogs 177 do 178 _install L ../../${APACHE_DIR_PREFIX}/bin/${MACH64}/${i} ${ROOT}/usr/bin/${MACH64}/${i} 179 done 180 181 for i in ${PREFIX} ${VARDIR}; do 182 cd ${i} 183 for j in `ls -p`; do 184 if test -d "${j}/${MACH64}"; then 185 _install L ${MACH64} ${j}/64 186 fi 187 done 188 done 189 } 190 191 # replace build environment specific paths 192 replace_build_path() { 193 cd ${BUILDDIR} 194 for i in `ls -Lp | grep -v '/$'`; do 195 sed -e "s;${ROOT};;g" \ 196 -e "s;-M ${MAPFILE_NOEXSTK} ;;g" \ 197 -e "s;${SPRO_VROOT}/bin/;;g" \ 198 -e "s;${APR_SRC_DIR64};${APR_USR_PREFIX};g" \ 199 -e "s;${APR_UTIL_SRC_DIR64};${APR_UTIL_USR_PREFIX};g" \ 200 -e "s;${APACHE_SRC_PREFORK_DIR64};${APACHE_USR_PREFIX};g" \ 201 -e "s;${APACHE_SRC_WORKER_DIR64};${APACHE_USR_PREFIX};g" < ${i} > ${i}.tmp 202 cp -f ${i}.tmp ${i} 203 rm -f ${i}.tmp 204 done 205 } 206 207 # remove the bundled but disabled (by default) modules from modules-64.load 208 remove_disabled_modules() { 209 cd ${TOP}/Solaris 210 sed -e 's/#.*//' -e '/^$/ d' ./disabled-module.list > ./tmp-disabled.list 211 for i in `cat ./tmp-disabled.list`; do 212 sed -e '/LoadModule.*'${i}'.so/ d' ${CONFDIR}/conf.d/modules-64.load > ${CONFDIR}/conf.d/tmp-64.load 213 mv ${CONFDIR}/conf.d/tmp-64.load ${CONFDIR}/conf.d/modules-64.load 214 done 215 rm -f ./tmp-disabled.list 216 } 217 218 # START HERE - actual script processing starts here 219 220 # Even though this is called "install-apache", it doesn't really 221 # install the whole thing. Much of apache itself is installed by 222 # make install - we need to fix permissions. What we install here 223 # are modules that apache won't install as part of its normal build. 224 # Each install task is a function, so it's relatively easy to add new 225 # stuff. 226 227 TOP=`pwd` 228 229 PREFIX=${ROOT}${APACHE_USR_PREFIX} 230 CONFDIR=${ROOT}${APACHE_ETC_PREFIX} 231 VARDIR=${ROOT}${APACHE_VAR_PREFIX} 232 233 BINDIR=${PREFIX}/bin/${MACH64} 234 BUILDDIR=${PREFIX}/build/${MACH64} 235 LIBDIR=${PREFIX}/lib/${MACH64} 236 LIBEXECDIR=${PREFIX}/libexec/${MACH64} 237 MOD_AUTH_GSS_DIR=${TOP}/mod_auth_gss-64/.libs 238 APACHE_SRC_PREFORK_DIR64=${TOP}/${APACHE_PREFORK_DIR64} 239 APACHE_SRC_WORKER_DIR64=${TOP}/${APACHE_WORKER_DIR64} 240 APR_SRC_DIR64=${SRC}/cmd/apr/apr-${APR_VERSION_DIR}/${APR_DIR64} 241 APR_UTIL_SRC_DIR64=${SRC}/cmd/apr-util/apr-util-${APR_UTIL_VERSION_DIR}/${APR_UTIL_DIR64} 242 243 disable_suexec 244 install_real_bins 245 fix_config_files 246 install_smf_hooks 247 install_auth_gss 248 post_process 249 fix_build_config 250 remove_disabled_modules 251 replace_build_path 252 create_sym_links 253 # the 32-bit installl runs after this, so don't fix file permissions here 254 255 exit 0 256