9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# CDDL HEADER START
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# The contents of this file are subject to the terms of the
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# Common Development and Distribution License (the "License").
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# You may not use this file except in compliance with the License.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# See the License for the specific language governing permissions
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# and limitations under the License.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# When distributing Covered Code, include this CDDL HEADER in each
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# If applicable, add the following below this CDDL HEADER, with the
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# fields enclosed by brackets "[]" replaced with your own identifying
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# information: Portions Copyright [yyyy] [name of copyright owner]
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# CDDL HEADER END
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# Install DNS client service
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywoodunset dns_install_domain dns_install_servers dns_install_search
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $DNS_INSTALL_PG/nameserver $DNS_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -eq 0 -a "$prop" != "$NET_INADDR_ANY" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $DNS_INSTALL_PG/domain $DNS_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -eq 0 -a "$prop" != "$DNS_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $DNS_INSTALL_PG/search $DNS_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -eq 0 -a "$prop" != "$DNS_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood [ $config -ne 0 ] || return $SMF_EXIT_OK
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood net_record_err "Error creating \"/etc/resolv.conf.$$\"" $?
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood echo "nameserver $server" >>/etc/resolv.conf.$$
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood echo "domain $dns_install_domain" >>/etc/resolv.conf.$$
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood /usr/bin/mv /etc/resolv.conf.$$ /etc/resolv.conf
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="Error moving /etc/resolv.conf.$$ to \"/etc/resolv.conf\""
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="Error setting permissions on \"/etc/resolv.conf\""
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood /usr/bin/cp -f /etc/nsswitch.dns /etc/nsswitch.conf
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="Error copying /etc/nsswitch.dns to \"/etc/nsswitch.conf\""
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="Error setting permissions on \"/etc/nsswitch.conf\""
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood vout=`$SVCCFG -s $DNS_INSTALL_FMRI validate 2>&1`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="Validation errors in $DNS_INSTALL_FMRI:\n$vout"
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood pg=`$SVCPROP -p $DNS_INSTALL_PG $DNS_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -eq 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne $SMF_EXIT_OK ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood $SVCCFG -s $DNS_INSTALL_FMRI delpg $DNS_INSTALL_PG
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $dns_install_debug -eq 1 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $errs -ne 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $cntf -ne 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# Script execution starts here.