1 #!/bin/sh 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 28 # Install BIND's objects into the proto area ready for packaging. 29 # 30 31 #ident "@(#)install-bind 1.11 09/07/12 SMI" 32 33 # VERS should be provided on command line or set in environment 34 if [ $# -gt 0 ]; then 35 VERS=$1; 36 elif [ "${VERS}" = "" ]; then 37 echo "$0: Version not specified and Enviroment variable VERS not set!" 1>&2 38 exit 1 39 fi 40 41 if [ ! -d ${VERS} ]; then 42 echo "$0: Error: \"$VERS\" not a directory!" 1>&2 43 exit 1 44 fi 45 46 # Make sure post_process exists and is executable. It may not exist 47 # if it was missed by 'bringover'. It may not be executable if 48 # make(1) has not been used in parent directories previously 49 POSTPROCESS=${SRC}/tools/post_process 50 if [ -f ${POSTPROCESS} ]; then 51 if [ ! -x ${POSTPROCESS} ]; then 52 /usr/bin/chmod +x ${POSTPROCESS} 53 if [ ! -x ${POSTPROCESS} ]; then 54 echo "$0: Error: ${POSTPROCESS}: Failed to make executable!" >&2 55 exit 1 56 fi 57 fi 58 else 59 echo "$0: Error: ${POSTPROCESS}: Not found and is required!" >&2 60 exit 1 61 fi 62 63 PREFIX=${ROOT}/usr 64 BINDIR=${PREFIX}/sbin 65 LIBDIR=${PREFIX}/lib/dns 66 SBINDIR=${PREFIX}/sbin 67 DOCDIR=${PREFIX}/share/doc 68 MANIFESTDIR=${ROOT}/var/svc/manifest/network 69 METHODDIR=${ROOT}/lib/svc/method 70 71 cd ${VERS} 72 cur_src="`pwd`" 73 LIBTOOL="${cur_src}/libtool" 74 INSTALL="${cur_src}/install-sh -c" 75 INSTALL_PROGRAM="${INSTALL} -m 555 " 76 INSTALL_DATA="${INSTALL} -m 444" 77 MKINSTALLDIRS="${cur_src}/mkinstalldirs" 78 79 # Install libraries. 80 # Both the dynamic and static libraries are installed. 81 # The static libraries are later removed! 82 # The order of lib subdir is important. 83 # 84 # libtool may moan that libraries are not installed in /usr/lib/dns. 85 # That's because we are installing to the proto area for packaging. 86 /bin/bash ${MKINSTALLDIRS} ${LIBDIR} 87 chmod 755 ${LIBDIR} 88 for f in "lib/isc/libisc.la" \ 89 "lib/isccc/libisccc.la" \ 90 "lib/dns/libdns.la" \ 91 "lib/isccfg/libisccfg.la" \ 92 "lib/lwres/liblwres.la" \ 93 "lib/bind9/libbind9.la" 94 do 95 cd ${cur_src}/`dirname ${f}` 96 fn=`basename ${f}` 97 ${LIBTOOL} --mode=install ${INSTALL_DATA} ${fn} ${LIBDIR} 98 if [ ! -f ${LIBDIR}/$fn ]; then 99 echo "$0: Error: ${fn} not installed in ${LIBDIR}!" >&2 100 exit 1 101 fi 102 done 103 104 # Install binaries 105 /bin/bash ${MKINSTALLDIRS} ${SBINDIR} 106 for f in "bin/named/named" \ 107 "bin/rndc/rndc" "bin/rndc/rndc-confgen" \ 108 "bin/dig/dig" "bin/dig/host" "bin/dig/nslookup" \ 109 "bin/dnssec/dnssec-keygen" "bin/dnssec/dnssec-signzone" \ 110 "bin/dnssec/dnssec-dsfromkey" "bin/dnssec/dnssec-keyfromlabel" \ 111 "bin/nsupdate/nsupdate" \ 112 "bin/check/named-checkconf" "bin/check/named-checkzone" 113 do 114 if [ ! -f ${cur_src}/${f} ]; then 115 echo "$0: Error: Binary file \"$f\" does not exist!" >&2 116 exit 1 117 fi 118 cd ${cur_src}/`dirname ${f}` 119 iprog=`basename ${f}` 120 121 ${LIBTOOL} --mode=install ${INSTALL_PROGRAM} ${iprog} ${SBINDIR}/${iprog} 122 cd ${SBINDIR} 123 # Postprocess needs file to be writeable 124 if [ ! -w ${iprog} ]; then 125 # Try and make it writable for non-root building. 126 chmod u+w $iprog 127 if [ ! -w ${iprog} ]; then 128 echo "$0: Warning: $iprog: binary not writeable!" >&2 129 fi 130 ${POSTPROCESS} ${iprog} 131 chmod u-w ${iprog} 132 else 133 ${POSTPROCESS} ${iprog} 134 fi 135 done 136 137 # Create symbolic links for backward compatability. 138 cd ${SBINDIR} 139 rm -rf in.named 140 rm -rf ndc 141 ln -s named in.named 142 ln -s rndc ndc 143 144 # Install migration.txt documentation. 145 cd ${cur_src} 146 /bin/bash ${MKINSTALLDIRS} ${DOCDIR}/bind 147 chmod 755 ${DOCDIR} 148 chmod 755 ${DOCDIR}/bind 149 ${INSTALL_DATA} ../migration.txt ${DOCDIR}/bind 150 151 # Install smf(5) manifest file. 152 if [ ! -d ${MANIFESTDIR} ]; then 153 /bin/bash ${MKINSTALLDIRS} ${MANIFESTDIR} 154 chmod 755 ${MANIFESTDIR} 155 fi 156 if [ ! -d ${MANIFESTDIR}/dns ]; then 157 /bin/bash ${MKINSTALLDIRS} ${MANIFESTDIR}/dns 158 chmod 755 ${MANIFESTDIR}/dns 159 fi 160 ${INSTALL_DATA} ../server.xml ${MANIFESTDIR}/dns 161 162 # Install smf_method(5) script, removing .sh suffix. 163 if [ ! -d ${METHODDIR} ]; then 164 /bin/bash ${MKINSTALLDIRS} ${METHODDIR} 165 chmod 755 ${METHODDIR} 166 fi 167 ${INSTALL_PROGRAM} ../dns-server.sh -t="s/\.sh\$//" ${METHODDIR} 168 169 # Remove static libraries which were installed above! 170 # We don't ship any static libraries. 171 rm -rf ${LIBDIR}/libdns.*a* 172 rm -rf ${LIBDIR}/libisc*.*a* 173 rm -rf ${LIBDIR}/liblwres.*a* 174 rm -rf ${LIBDIR}/libbind9.*a* 175 176 exit 0 177