net-nwam revision d62bc4badc1c1f1549c961cfb8b420e650e1272b
c78c39caab4cf8b5daefc9c65878f7f5ed3eb7a0Tinderbox User# CDDL HEADER START
ab496cc3df1648e9ad992a87c35c2c0870fdc69dTinderbox User# The contents of this file are subject to the terms of the
7c1468ed500356839a4a222517364e6ce18cb1a2Tinderbox User# Common Development and Distribution License (the "License").
c57668a2fbbe558c1bd21652813616f2f517c469Tinderbox User# You may not use this file except in compliance with the License.
287a6a8f9040dc43560cd69cddf83bfc0f53b76fTinderbox User# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8de3f14f1c300c3e1ed99084cc03485b42c92bf1Tinderbox User# See the License for the specific language governing permissions
950d203b64f512b85fcc093ee1e9e3e531a1aea3Tinderbox User# and limitations under the License.
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews# When distributing Covered Code, include this CDDL HEADER in each
e676a596869d8a80a644c99a848afb53d1c5975eMark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
e676a596869d8a80a644c99a848afb53d1c5975eMark Andrews# If applicable, add the following below this CDDL HEADER, with the
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# fields enclosed by brackets "[]" replaced with your own identifying
a7c412f37cc73d0332887a746e81220cbf09dd00Mark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# CDDL HEADER END
e676a596869d8a80a644c99a848afb53d1c5975eMark Andrews# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Use is subject to license terms.
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User#ident "%Z%%M% %I% %E% SMI"
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# In a shared-IP zone we need this service to be up, but all of the work
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User# it tries to do is irrelevant (and will actually lead to the service
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# failing if we try to do it), so just bail out.
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User# In the global zone and exclusive-IP zones we proceed.
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater # Upgrade handling. The upgrade file consists of a series
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt # of dladm(1M) commands. Note that after we are done, we
dc238a06bffa79de141ee7655765e2df91498a8aTinderbox User # cannot rename the upgrade script file as the file system
0e573cdd111e060e5f6c18249b5ccacbe8abe278Tinderbox User # is still read-only at this point. Defer this to the
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt # manifest-import service.
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater upgrade_script=/var/svc/profile/upgrade_datalink
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater if [ -f "${upgrade_script}" ]; then
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater . "${upgrade_script}"
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews # Initialize security objects.
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews # start nwamd in foreground; it will daemonize itself
015055b6e23f5c08f6a5b34726f90b62597e9e45Tinderbox User # After we run this part of the script upon the next reboot
2ae159b376dac23870d8005563c585acf85a4b5aEvan Hunt # network/physical:default will be enabled and
2ae159b376dac23870d8005563c585acf85a4b5aEvan Hunt # network/physical:nwam will be disabled.
e40c4e4c17d4df338e2a7db0f84d8dbb3858964cTinderbox User # There are various other parts of the system (nscd, nfs) that
95637507c3d47481fbf0a8a8c750a57f944f677fMark Andrews # depend on continuing to have a working network. For this
2ae159b376dac23870d8005563c585acf85a4b5aEvan Hunt # reason we don't change the network configuration immediately.
7cc0a5d21ef046bfd630c4769943d896a7d7472cTinderbox User # Disable network/physical temporarily and make sure that will
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews # be enabled on reboot.
ee11dfc481f2ef6a032a715454f6290961a722d2Tinderbox User $SVCCFG -s $net_phys setprop general/enabled=true
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # If nwam is online then make sure that it's temporarily enabled.
e40c4e4c17d4df338e2a7db0f84d8dbb3858964cTinderbox User nwam_online=`/usr/bin/svcprop -t -p restarter/state $net_nwam`
0e573cdd111e060e5f6c18249b5ccacbe8abe278Tinderbox User [ $3 = "online" ] && $SVCADM enable -st $net_nwam
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # Set nwam so that it won't be enabled upon reboot.
e40c4e4c17d4df338e2a7db0f84d8dbb3858964cTinderbox User $SVCCFG -s $net_nwam setprop general/enabled=false
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User # Nothing to do for sysidtool
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews echo "Usage: $0 { start | stop | refresh }"