usr/src/cmd/bind/install-bind
changeset 0 b34509ac961f
child 14 ebdd963f7d5e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/bind/install-bind	Wed Oct 21 17:43:30 2009 +0200
@@ -0,0 +1,176 @@
+#!/bin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+# Install BIND's objects into the proto area ready for packaging.
+#
+
+#ident	"@(#)install-bind	1.11	09/07/12 SMI"
+
+# VERS should be provided on command line or set in environment
+if [ $# -gt 0 ]; then
+    VERS=$1;
+elif [ "${VERS}" = "" ]; then
+    echo "$0: Version not specified and Enviroment variable VERS not set!" 1>&2
+    exit 1
+fi
+
+if [ ! -d ${VERS} ]; then
+    echo "$0: Error: \"$VERS\" not a directory!" 1>&2
+    exit 1
+fi
+
+# Make sure post_process exists and is executable.  It may not exist
+# if it was missed by 'bringover'.  It may not be executable if
+# make(1) has not been used in parent directories previously
+POSTPROCESS=${SRC}/tools/post_process
+if [ -f ${POSTPROCESS} ]; then
+    if [ ! -x ${POSTPROCESS} ]; then
+	/usr/bin/chmod +x ${POSTPROCESS}
+	if [ ! -x ${POSTPROCESS} ]; then
+	    echo "$0: Error: ${POSTPROCESS}: Failed to make executable!" >&2
+	    exit 1
+	fi
+    fi
+else
+    echo "$0: Error: ${POSTPROCESS}: Not found and is required!" >&2
+    exit 1
+fi
+
+PREFIX=${ROOT}/usr
+BINDIR=${PREFIX}/sbin
+LIBDIR=${PREFIX}/lib/dns
+SBINDIR=${PREFIX}/sbin
+DOCDIR=${PREFIX}/share/doc
+MANIFESTDIR=${ROOT}/var/svc/manifest/network
+METHODDIR=${ROOT}/lib/svc/method
+
+cd ${VERS}
+cur_src="`pwd`"
+LIBTOOL="${cur_src}/libtool"
+INSTALL="${cur_src}/install-sh -c"
+INSTALL_PROGRAM="${INSTALL} -m 555 "
+INSTALL_DATA="${INSTALL} -m 444"
+MKINSTALLDIRS="${cur_src}/mkinstalldirs"
+
+# Install libraries.
+# Both the dynamic and static libraries are installed.
+# The static libraries are later removed!
+# The order of lib subdir is important.
+#
+# libtool may moan that libraries are not installed in /usr/lib/dns.
+# That's because we are installing to the proto area for packaging.
+/bin/bash ${MKINSTALLDIRS} ${LIBDIR}
+chmod 755 ${LIBDIR}
+for f in "lib/isc/libisc.la" \
+	"lib/isccc/libisccc.la" \
+	"lib/dns/libdns.la" \
+	"lib/isccfg/libisccfg.la" \
+	"lib/lwres/liblwres.la" \
+	"lib/bind9/libbind9.la"
+do
+	cd ${cur_src}/`dirname ${f}`
+	fn=`basename ${f}`
+	${LIBTOOL} --mode=install ${INSTALL_DATA} ${fn} ${LIBDIR}
+	if [ ! -f ${LIBDIR}/$fn ]; then
+	    echo "$0: Error: ${fn} not installed in ${LIBDIR}!" >&2
+	    exit 1
+	fi
+done
+
+# Install binaries
+/bin/bash ${MKINSTALLDIRS} ${SBINDIR}
+for f in "bin/named/named" \
+        "bin/rndc/rndc" "bin/rndc/rndc-confgen" \
+	"bin/dig/dig" "bin/dig/host" "bin/dig/nslookup" \
+        "bin/dnssec/dnssec-keygen" "bin/dnssec/dnssec-signzone" \
+        "bin/dnssec/dnssec-dsfromkey" "bin/dnssec/dnssec-keyfromlabel" \
+	"bin/nsupdate/nsupdate" \
+        "bin/check/named-checkconf" "bin/check/named-checkzone"
+do
+	if [ ! -f ${cur_src}/${f} ]; then
+	    echo "$0: Error: Binary file \"$f\" does not exist!" >&2
+	    exit 1
+	fi
+	cd ${cur_src}/`dirname ${f}`
+	iprog=`basename ${f}`
+
+        ${LIBTOOL} --mode=install ${INSTALL_PROGRAM} ${iprog} ${SBINDIR}/${iprog}
+	cd ${SBINDIR}
+	# Postprocess needs file to be writeable
+	if [ ! -w ${iprog} ]; then
+	    # Try and make it writable for non-root building.
+	    chmod u+w $iprog
+	    if [ ! -w ${iprog} ]; then
+		echo "$0: Warning: $iprog: binary not writeable!" >&2
+	    fi
+	    ${POSTPROCESS} ${iprog}
+	    chmod u-w ${iprog}
+	else
+	    ${POSTPROCESS} ${iprog}
+	fi
+done
+
+# Create symbolic links for backward compatability.
+cd ${SBINDIR}
+rm -rf in.named
+rm -rf ndc
+ln -s named in.named
+ln -s rndc ndc
+
+# Install migration.txt documentation.
+cd ${cur_src}
+/bin/bash ${MKINSTALLDIRS} ${DOCDIR}/bind
+chmod 755 ${DOCDIR}
+chmod 755 ${DOCDIR}/bind
+${INSTALL_DATA} ../migration.txt ${DOCDIR}/bind
+
+# Install smf(5) manifest file.
+if [ ! -d ${MANIFESTDIR} ]; then
+	/bin/bash ${MKINSTALLDIRS} ${MANIFESTDIR}
+	chmod 755 ${MANIFESTDIR}
+fi
+if [ ! -d ${MANIFESTDIR}/dns ]; then
+	/bin/bash ${MKINSTALLDIRS} ${MANIFESTDIR}/dns
+	chmod 755 ${MANIFESTDIR}/dns
+fi
+${INSTALL_DATA} ../server.xml ${MANIFESTDIR}/dns
+
+# Install smf_method(5) script, removing .sh suffix.
+if [ ! -d ${METHODDIR} ]; then
+	/bin/bash ${MKINSTALLDIRS} ${METHODDIR}
+	chmod 755 ${METHODDIR}
+fi
+${INSTALL_PROGRAM} ../dns-server.sh -t="s/\.sh\$//" ${METHODDIR}
+
+# Remove static libraries which were installed above!
+# We don't ship any static libraries.
+rm -rf ${LIBDIR}/libdns.*a*
+rm -rf ${LIBDIR}/libisc*.*a*
+rm -rf ${LIBDIR}/liblwres.*a*
+rm -rf ${LIBDIR}/libbind9.*a*
+
+exit 0