dns-client revision 2
0N/A#!/sbin/sh
2362N/A#
0N/A# CDDL HEADER START
0N/A#
0N/A# The contents of this file are subject to the terms of the
0N/A# Common Development and Distribution License (the "License").
2362N/A# You may not use this file except in compliance with the License.
0N/A#
2362N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0N/A# or http://www.opensolaris.org/os/licensing.
0N/A# See the License for the specific language governing permissions
0N/A# and limitations under the License.
0N/A#
0N/A# When distributing Covered Code, include this CDDL HEADER in each
0N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0N/A# If applicable, add the following below this CDDL HEADER, with the
0N/A# fields enclosed by brackets "[]" replaced with your own identifying
0N/A# information: Portions Copyright [yyyy] [name of copyright owner]
0N/A#
0N/A# CDDL HEADER END
2362N/A#
2362N/A#
2362N/A# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
0N/A#
0N/A
0N/A#
0N/A# Install DNS client service
0N/A#
0N/A
0N/A. /lib/svc/share/smf_include.sh
2080N/A. /lib/svc/share/net_include.sh
2080N/A
0N/A# Test and import if upgrade
0N/Acase "$1" in
0N/A'start')
0N/A # Test and import if upgrade
0N/A /usr/sbin/nscfg import -q $SMF_FMRI
0N/A err=$?
0N/A if [ $err -eq 1 ] ; then
955N/A msg="WARNING: $SMF_FMRI configuration import error."
955N/A net_record_err "$msg" $err
955N/A exit $SMF_EXIT_ERR_CONFIG
955N/A elif [ $err -eq 3 ] ; then
955N/A msg="WARNING: $SMF_FMRI no configuration."
955N/A net_record_err "$msg" $err
955N/A exit $SMF_EXIT_ERR_CONFIG
955N/A fi
955N/A /usr/sbin/nscfg export $SMF_FMRI
955N/A err=$?
2157N/A if [ $err -eq 1 ] ; then
2157N/A msg="Error creating /etc/resolv.conf"
0N/A net_record_err "$msg" $err
0N/A return $SMF_EXIT_ERR_FATAL
0N/A fi
0N/A ;;
0N/A'refresh')
0N/A /usr/sbin/nscfg export $SMF_FMRI
0N/A err=$?
0N/A if [ $err -eq 2 ] ; then
0N/A exit $SMF_EXIT_OK
0N/A elif [ $err -ne 0 ]; then
0N/A msg="Error creating /etc/resolv.conf"
2080N/A net_record_err "$msg" $err
0N/A return $SMF_EXIT_ERR_FATAL
0N/A fi
0N/A ;;
2080N/A'unconfigure')
0N/A # Permanently shutdown service
0N/A svcadm disable $SMF_FMRI
0N/A # Unroll any admin customization
2080N/A svccfg -s svc:/network/dns/client delcust
0N/A if [ $? -ne 0 ]; then
0N/A echo "Failed to unroll administrative customizations for $SMF_FMRI"
0N/A exit $SMF_EXIT_ERR_FATAL
2080N/A fi
0N/A svcadm refresh $SMF_FMRI
rm -f /etc/resolv.conf
;;
*)
echo "Usage: $0 { start | refresh | unconfigure }"
exit 1
;;
esac
exit $SMF_EXIT_OK