Home | History | Annotate | Download | only in lighttpd14
      1 #!/bin/ksh93 -e
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License (the "License").
      7 # You may not use this file except in compliance with the License.
      8 #
      9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10 # or http://www.opensolaris.org/os/licensing.
     11 # See the License for the specific language governing permissions
     12 # and limitations under the License.
     13 #
     14 # When distributing Covered Code, include this CDDL HEADER in each
     15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16 # If applicable, add the following below this CDDL HEADER, with the
     17 # fields enclosed by brackets "[]" replaced with your own identifying
     18 # information: Portions Copyright [yyyy] [name of copyright owner]
     19 #
     20 # CDDL HEADER END
     21 #
     22 
     23 #
     24 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     25 # Use is subject to license terms.
     26 #
     27 #ident	"@(#)install-sfw	1.2	09/02/25 SMI"
     28 
     29 set -o errexit
     30 
     31 source ${SRC}/tools/install.subr
     32 
     33 # functions - search for "START HERE" to find start of control flow
     34 
     35 install_smf_hooks() {
     36     cd ${TOP}/Solaris
     37     _install N http-lighttpd14.xml ${MANIFESTDIR}/http-lighttpd14.xml 444
     38     _install N http-lighttpd14 ${METHODDIR}/http-lighttpd14 555
     39 }
     40 
     41 post_process() {
     42     cd ${BINDIR}
     43     for i in \
     44         spawn-fcgi 
     45     do
     46         chmod u+w ${i}
     47         ${SRC}/tools/post_process ${i}
     48         chmod u-w ${i}
     49     done
     50 
     51     cd ${SBINDIR}
     52     for i in \
     53         lighttpd \
     54         lighttpd-angel
     55     do
     56         chmod u+w ${i}
     57         ${SRC}/tools/post_process ${i}
     58         chmod u-w ${i}
     59     done
     60 
     61     cd ${LIBDIR}
     62     for i in *.so
     63     do
     64         chmod u+w ${i}
     65         ${SRC}/tools/post_process_so ${i}
     66         chmod u-w ${i}
     67     done
     68 }
     69 
     70 cleanup_crud() {
     71     cd ${LIBDIR}
     72     rm *.la
     73 }
     74 
     75 fix_lighttpd_perms() {
     76 
     77     cd ${CONFDIR}
     78     find . -type f -exec chmod 644 {} \;
     79 
     80     cd ${PREFIX}
     81     APDIRS="man"
     82     find ${APDIRS} -type d -exec chmod 755 {} \;
     83     find ${APDIRS} -type f -exec chmod 444 {} \;
     84 
     85     cd ${PREFIX}
     86     APDIRS="bin lib sbin"
     87     find ${APDIRS} -type d -exec chmod 755 {} \;
     88     find ${APDIRS} -type f -exec chmod 555 {} \;
     89 
     90     cd ${VARDIR}
     91     APDIRS="docroot logs"
     92     find ${APDIRS} -type d -exec chmod 755 {} \;
     93     find ${APDIRS} -type f -exec chmod 644 {} \;
     94 }
     95 
     96 install_man_files() {
     97     cd ${TOP}/Solaris
     98     for manpage in \
     99       lighttpd.1 \
    100       spawn-fcgi.1 
    101     do
    102       rm ${PREFIX}/man/man1/${manpage}
    103       _install N ${manpage} ${PREFIX}/man/man1/${manpage} 444
    104     done
    105     _install N lighttpd.1m.sunman ${ROOT}/usr/share/man/man1m/lighttpd.1m 444
    106 }
    107 
    108 install_config_files() {
    109     cd ${TOP}/${VER}/doc
    110     _install N lighttpd.conf ${CONFDIR}/lighttpd.conf 644
    111     cd ${TOP}/Solaris
    112     _install N fcgi-php.conf ${CONFDIR}/conf.d/fcgi-php.conf 644
    113     _install N ssl.conf ${CONFDIR}/conf.d/ssl.conf 644
    114 }
    115 
    116 fix_config_files() {
    117     cd ${CONFDIR}
    118 
    119      sed -f ${TOP}/Solaris/lighttpdconf.sed lighttpd.conf > lighttpd.conf.new
    120      mv lighttpd.conf.new lighttpd.conf
    121 }
    122 
    123 # START HERE - actual script processing starts here
    124 
    125 TOP=`pwd`
    126 
    127 LIGHTTPD_VERSION=1.4
    128 PREFIX=${ROOT}/usr/lighttpd/${LIGHTTPD_VERSION}
    129 CONFDIR=$ROOT/etc/lighttpd/${LIGHTTPD_VERSION}
    130 VARDIR=$ROOT/var/lighttpd/${LIGHTTPD_VERSION}
    131 DOCROOT=${VARDIR}/docroot
    132 MANDIR=${PREFIX}/man
    133 MAN1DIR=${MANDIR}/man1
    134 ETC=${ROOT}/etc
    135 
    136 BINDIR=${PREFIX}/bin
    137 SBINDIR=${PREFIX}/sbin
    138 LIBDIR=${PREFIX}/lib
    139 
    140 MANIFESTDIR=${ROOT}/var/svc/manifest/network
    141 METHODDIR=${ROOT}/lib/svc/method
    142 
    143 install_smf_hooks
    144 post_process
    145 cleanup_crud
    146 install_config_files
    147 install_man_files
    148 fix_config_files
    149 
    150 # all installation should be done before this point, so the functions
    151 # that fixup permissions can get everything that is installed.
    152 
    153 fix_lighttpd_perms
    154 
    155 exit 0
    156