ns-switch revision 2
0N/A#!/sbin/sh
3261N/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
2129N/A#
2129N/A# Name service switch configuration service
2129N/A#
2129N/A
2129N/A. /lib/svc/share/smf_include.sh
2129N/A. /lib/svc/share/net_include.sh
2324N/A
2324N/Acase "$1" in
2324N/A'start')
2324N/A # Test and import if upgrade
2324N/A /usr/sbin/nscfg import -q $SMF_FMRI
2324N/A err=$?
2324N/A if [ $err -eq 1 ] ; then
2129N/A msg="WARNING: $SMF_FMRI configuration import error."
2129N/A net_record_err "$msg" $err
2129N/A exit $SMF_EXIT_ERR_CONFIG
2129N/A elif [ $err -eq 3 ] ; then
2129N/A msg="WARNING: $SMF_FMRI no configuration file found."
2129N/A net_record_err "$msg" $err
0N/A exit $SMF_EXIT_ERR_CONFIG
0N/A fi
0N/A /usr/sbin/nscfg export $SMF_FMRI
0N/A err=$?
0N/A if [ $err -eq 1 ]; then
0N/A msg="WARNING: $SMF_FMRI configuration export error."
0N/A net_record_err "$msg" $err
0N/A exit $SMF_EXIT_ERR_CONFIG
0N/A fi
0N/A ;;
0N/A'refresh')
0N/A /usr/sbin/nscfg export $SMF_FMRI
0N/A err=$?
2129N/A if [ $err -eq 2 ] ; then
2129N/A exit $SMF_EXIT_OK
2129N/A elif [ $err -ne 0 ]; then
2129N/A msg="WARNING: $SMF_FMRI configuration export error."
2129N/A net_record_err "$msg" $err
2129N/A exit $SMF_EXIT_ERR_CONFIG
2129N/A fi
2129N/A ;;
0N/A'unconfigure')
0N/A # Unroll any admin customization
0N/A svccfg -s svc:/system/name-service/switch 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
0N/A fi
0N/A svcadm refresh svc:/system/name-service/switch
0N/A # Revert legacy config to original state
0N/A /usr/sbin/nscfg export $SMF_FMRI
0N/A ;;
2129N/A
2129N/A*)
2129N/A echo "Usage: $0 { start | refresh | unconfigure }"
2129N/A exit 1
2129N/A ;;
2129N/Aesac
2129N/A
2129N/Aexit $SMF_EXIT_OK
2129N/A