net-nwam revision afc7d54587eb70585fcc35b5f933cc1ed713d87a
0N/A#!/sbin/sh
0N/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").
0N/A# You may not use this file except in compliance with the License.
0N/A#
0N/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
0N/A#
0N/A#
0N/A# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
0N/A# Use is subject to license terms.
0N/A#
0N/A
0N/A#ident "%Z%%M% %I% %E% SMI"
0N/A
0N/A. /lib/svc/share/smf_include.sh
0N/A
0N/A#
0N/A# In a shared-IP zone we need this service to be up, but all of the work
0N/A# it tries to do is irrelevant (and will actually lead to the service
0N/A# failing if we try to do it), so just bail out.
0N/A# In the global zone and exclusive-IP zones we proceed.
0N/A#
0N/Asmf_configure_ip || exit $SMF_EXIT_OK
0N/A
0N/Acase "$1" in
0N/A'refresh')
0N/A /usr/bin/pkill -HUP -z `smf_zonename` nwamd
0N/A ;;
0N/A
0N/A'start')
0N/A if smf_is_globalzone; then
0N/A # Initialize security objects.
0N/A /sbin/dladm init-secobj
0N/A fi
0N/A # start nwamd in foreground; it will daemonize itself
0N/A if /lib/inet/nwamd ; then
0N/A exit $SMF_EXIT_OK
0N/A else
0N/A exit $SMF_EXIT_ERR_FATAL
0N/A fi
0N/A ;;
0N/A
0N/A'stop')
0N/A /usr/bin/pkill -z `smf_zonename` nwamd
0N/A ;;
0N/A
0N/A'-u')
0N/A # After we run this part of the script upon the next reboot
0N/A # network/physical:default will be enabled and
0N/A # network/physical:nwam will be disabled.
0N/A # There are various other parts of the system (nscd, nfs) that
0N/A # depend on continuing to have a working network. For this
0N/A # reason we don't change the network configuration immediately.
0N/A
0N/A SVCADM=/usr/sbin/svcadm
0N/A SVCCFG=/usr/sbin/svccfg
0N/A net_phys=svc:/network/physical:default
0N/A net_nwam=svc:/network/physical:nwam
0N/A
0N/A # Disable network/physical temporarily and make sure that will
0N/A # be enabled on reboot.
0N/A $SVCADM disable -st $net_phys
0N/A $SVCCFG -s $net_phys setprop general/enabled=true
0N/A
0N/A # If nwam is online then make sure that it's temporarily enabled.
0N/A nwam_online=`/usr/bin/svcprop -t -p restarter/state $net_nwam`
0N/A if [ $? -eq 0 ]; then
0N/A set -- $nwam_online
0N/A [ $3 = "online" ] && $SVCADM enable -st $net_nwam
0N/A fi
0N/A
0N/A # Set nwam so that it won't be enabled upon reboot.
0N/A $SVCCFG -s $net_nwam setprop general/enabled=false
0N/A exit 0
0N/A ;;
0N/A
0N/A'-c')
0N/A # Nothing to do for sysidtool
0N/A exit 0
0N/A ;;
0N/A
0N/A*)
0N/A echo "Usage: $0 { start | stop | refresh }"
0N/A exit $SMF_EXIT_ERR_FATAL
0N/A ;;
0N/Aesac
0N/Aexit $SMF_EXIT_OK
0N/A