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